Using the ddsmoothmenu as a navigation control. Works great on all pages except for the one where I have three gridviews that databind on page_load. The error that pops is:
Microsoft JScript runtime error: 'ddsmoothmenu' is undefined. Now, I'm sure it has something to do with the way asp.net builds the page after the code behind runs...I just don't know what or where the problem is.
Like I said, the plugin runs great on all other pages, so I know the .js file is being found.
I really don't want to have to rebuild the nav tool on the pages. Any help will be greatly appreicated!
And it still kicked the same error (Microsoft JScript runtime error: 'ddsmoothmenu' is undefined). So, the page acts like it's not finding the ddsmoothmenu.js even though it's in the <head>. Something in the page lifecycle is causing this, but what?
Hold the phone, I think it has nothing to do with anything I've been saying.
I took a look at the source code. Both home.aspx and logon.aspx reside in the root of the project. However myproductivity.aspx resides in a folder called prod.
When I looked at the source code for home.aspx, href's show as "Scripts/ddsmoothmenu.js". However when I look at myproductivity.aspx the href's change to "../Scripts/ddsmoothmenu.js". That reminded me of an issue I had with a image not being shown correctly
and a pathing issue with master pages. Quick visit to the Google machine and a change in the master page <head> from
<script href="Script/ddsmoothmenu.js" type="text/javscript"></script>
to
<script src="/Script/ddsmoothmenu.js" type="text/javascript"></script>
fixed it.
Note the change from href to src and the additional '/'. This is why I hate master pages.
I'm having the same issue ("ddsmoothmenu is undefined"), but my "script" element has the correct "src" attribute. If I copy/paste all of the appropriate code to a regular html page, it works fine.
The top-level menu shows up, but the dropdowns don't display.
I have this in my master page, followed immediately by a script element that calls ddsmoothmenu.init() (both are in the head section of the document.
Using Page.ResolveUrl("~") returns the URL as an app absolute path. If your master page is in a different level in the folder structure (i.e. in the root) and your images are in
a subfolder the master page cannot resolve the path.
I plop the Page.ResolveUrl piece in everything that has a path, such as images. You could add a "runat=server" to the img tag but I find that kind of wonky.
I hate hate hate masterpages on so many levels......
marrtodd
0 Points
5 Posts
"Error: 'ddsmoothmenu' is undefined" is driving me nuts
Aug 16, 2012 04:38 PM|LINK
Hoping someone can give me a hand with this.
Using the ddsmoothmenu as a navigation control. Works great on all pages except for the one where I have three gridviews that databind on page_load. The error that pops is: Microsoft JScript runtime error: 'ddsmoothmenu' is undefined. Now, I'm sure it has something to do with the way asp.net builds the page after the code behind runs...I just don't know what or where the problem is.
Like I said, the plugin runs great on all other pages, so I know the .js file is being found.
I really don't want to have to rebuild the nav tool on the pages. Any help will be greatly appreicated!
jimbo_manson
Member
6 Points
3 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Aug 16, 2012 04:46 PM|LINK
Could you post the portion of code that are using?
marrtodd
0 Points
5 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Aug 16, 2012 04:51 PM|LINK
Now that I read this I realized I forgot one important fact...the site uses master pages. Well, one master page that holds the ddsmoothmenu plugin.
As for code, do you want what I have in the head? The actual .js file? The code behind? There's a lot that I can post in here......
marrtodd
0 Points
5 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Aug 16, 2012 05:21 PM|LINK
Just tried this:
Page.ClientScript.RegisterStartupScript(Me.GetType, "Script", "ddsmoothmenu.init({mainmenuid: 'menu_wrapper', orientation: 'h', classname: 'ddsmoothmenu', customtheme: ['#4C4C4C', '#808080'], contentsource: 'markup' })", True)
And it still kicked the same error (Microsoft JScript runtime error: 'ddsmoothmenu' is undefined). So, the page acts like it's not finding the ddsmoothmenu.js even though it's in the <head>. Something in the page lifecycle is causing this, but what?
marrtodd
0 Points
5 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Aug 16, 2012 06:02 PM|LINK
Hold the phone, I think it has nothing to do with anything I've been saying.
I took a look at the source code. Both home.aspx and logon.aspx reside in the root of the project. However myproductivity.aspx resides in a folder called prod.
When I looked at the source code for home.aspx, href's show as "Scripts/ddsmoothmenu.js". However when I look at myproductivity.aspx the href's change to "../Scripts/ddsmoothmenu.js". That reminded me of an issue I had with a image not being shown correctly and a pathing issue with master pages. Quick visit to the Google machine and a change in the master page <head> from
fixed it.
Note the change from href to src and the additional '/'. This is why I hate master pages.
jsimmons3
Member
2 Points
2 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Dec 13, 2012 03:54 PM|LINK
I'm having the same issue ("ddsmoothmenu is undefined"), but my "script" element has the correct "src" attribute. If I copy/paste all of the appropriate code to a regular html page, it works fine.
The top-level menu shows up, but the dropdowns don't display.
I have this in my master page, followed immediately by a script element that calls ddsmoothmenu.init() (both are in the head section of the document.
marrtodd
0 Points
5 Posts
Re: "Error: 'ddsmoothmenu' is undefined" is driving me nuts
Dec 13, 2012 04:42 PM|LINK
Replace the script directive with this:
<script src="<%= Page.ResolveUrl("~")%>Script/mp_ddsmoothmenu.js" type="text/javascript"></script>Using Page.ResolveUrl("~") returns the URL as an app absolute path. If your master page is in a different level in the folder structure (i.e. in the root) and your images are in a subfolder the master page cannot resolve the path.
I plop the Page.ResolveUrl piece in everything that has a path, such as images. You could add a "runat=server" to the img tag but I find that kind of wonky.
I hate hate hate masterpages on so many levels......