Last post Sep 29, 2008 11:18 PM by bleroy
Aug 31, 2008 07:42 AM|JDL1475|LINK
I am trying to use a JQuery plugin, and everything works great until I add an
It works fine using standard html links with in-line script, however I would like to utilize AJAX for some other things on my page, therefore I do need the
ScriptManager? Any suggestions?
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:ScriptReference Path="~/js/jquery/jquery-1.2.6.min.js" />
<asp:ScriptReference Path="~/js/jquery/jquery.dimensions.min.js" />
<asp:ScriptReference Path="~/js/jquery/jquery.jDrawer.js" />
<ul id="jDrawer-1" style="display: none">
<a href="index.aspx" mce_href="index.aspx"><img class="png" alt="Text" src="images/picture.png" mce_src="images/picture.png" /></a>
<a href="index.aspx" mce_href="index.aspx">Click Here</a>
Aug 31, 2008 11:53 AM|NC01|LINK
If you've got a ScriptManager object, you must be using AJAX. How are you adding the inline code to your page? Inline code generally works on a full page PostBack, which AJAX doesn't do.
http://tech-review.org/blogs/.net_2.0/archive/2007/02/08/lets-talk-scriptmanger.aspx for more information.
Sep 01, 2008 05:53 AM|JDL1475|LINK
the Page_Load event?
Sep 01, 2008 11:49 AM|NC01|LINK
You did not answer how you are adding the inline code to your page.
Sep 01, 2008 04:26 PM|JDL1475|LINK
I was trying to call the function by adding this inline jQuery script to the body of the page. It works fine on a regular html page, however in converting everything to asp.net I have hit a road block. What is the proper way to call this? Do I need to
add a statement to the server side code? Thanks for your help...
Sep 02, 2008 12:57 AM|gt1329a|LINK
Sep 02, 2008 04:59 AM|JDL1475|LINK
I originally had my page set up with regular script elements like this:
However, as soon as I added the scriptmanager to my page, the above code stopped working. I therefore assumed that I needed to create script references to the files in the scriptmanager, rather than using regular script elements. Either way, I can't seem
Sep 02, 2008 12:15 PM|NC01|LINK
I'll defer to Encosia on this one as he knows a heck of a lot more on AJAX and JQuery than I do.
Sep 02, 2008 01:51 PM|gt1329a|LINK
Sep 02, 2008 05:01 PM|JDL1475|LINK
Great thinking, but here is a copy of the top of the page source. Both ID's are the same:
Sys.WebForms.PageRequestManager.getInstance()._updateControls(, , , 90);
<ul id="jDrawer-1" style="display: none">
<a href="index.aspx"><img class="png" alt="Home Pic" src="images/building.png" /></a>
Sep 02, 2008 05:35 PM|gt1329a|LINK
Use Firebug to double check that there are no errors and that the scripts are all loading. Then, try using the console to issue that $('#jDrawer-1').jDrawer() command, and see if it works at all with the ScriptManager on the page or if it's a problem with
the timing of document.ready().
Sep 02, 2008 06:25 PM|JDL1475|LINK
Ok, I have tried this with my scripts in the script manager and also using just script element tags. Both ways Firebug does show an error on line 199 of my jquery.jDrawer.js I just checked it against my original html page that doesn't have any asp.net and
that didn't have any errors. Any more advice at this point? Let me know if you my entire script would be helpful.
Here is the firebug error:
Sep 04, 2008 04:15 AM|gt1329a|LINK
Sep 04, 2008 05:01 AM|JDL1475|LINK
I just disabled the dimensions script but it didn't make a difference. I also tried running the page in the New Google Chrome browser and it gave me these two errors. One is obviously the same as previously mentioned.
Uncaught TypeError: Cannot read property 'type' of undefinedhttp://localhost:1702/test/js/jquery/jquery.jDrawer.js (line 199)
Uncaught SyntaxError: Unexpected token <
http://www.daemn.com/js/actfix.js (line 1)
Sep 04, 2008 11:26 AM|NC01|LINK
And here are some other links for progress bars and such:
Sep 04, 2008 02:40 PM|gt1329a|LINK
jDrawer isn't a progress bar. It's an accordion (a nice one).
Jeremy, are you using the latest jDrawer? Is this page somewhere that I could take a look at it?
Sep 04, 2008 05:30 PM|JDL1475|LINK
you threw me off with the whole progress bar statement... jDrawer is a jQuery plugin that gives animated functionality to a series of div's and list's that act as an accordion menu.
Here is the jDrawer demo page:
*** My problem comes from adding an asp:scriptmanager to a page, just like this demo page, causes an error in the jDrawer script.
Sep 04, 2008 05:44 PM|JDL1475|LINK
I don't have my page hosted at the moment, but if you literally download or copy the demo page from my last post, add it to an aspx web form, then call it using jQuery it will work as
From there, if you simply drag an asp:scriptmanager onto the page, it stops working and
trips an error.
I just made a new page from scratch with nothing on it just to verify.
However if still necessary, I can definitely get you a copy of my personal page...let me know what you think
Sep 04, 2008 05:46 PM|gt1329a|LINK
Sep 04, 2008 11:05 PM|gt1329a|LINK
Change line 199 of jDrawer.js from this:
for(var i in arguments.length)
for(var i = 0; i++; i < arguments.length)
And it will work with a ScriptManager on the page.
Sep 05, 2008 12:12 AM|JDL1475|LINK
Dave... you just made my day!!! Thank You!
By chance did you try to recreate the problem, and if so, did you have the same problem after putting the scriptmanager on the page.
Or is setting the var value just a quick fix on my particular page. Either way it works, thanks again!
Sep 05, 2008 12:29 AM|gt1329a|LINK
Yeah, I had the same issue after downloading the jDrawer sample and adding a ScriptManager. I probably should have tried that at first, but hadn't ever seen the ScriptManager break a jQuery plugin and didn't think that was really the case.
Sep 29, 2008 11:18 PM|bleroy|LINK
Well, we're not exactly altering for. What we're doing is augmenting the Number prototype. The for (var i in arguments.length) line is a bug in this plug-in and wasn't actually doing anything previously: it was enumerating the property names of a number
(arguments.length) and as a Number by default has no properties the loop actually was never executed. This was just dead code.
Once you've extended the Number prototype, the loop starts actually executing (and failing).
Note that we're never extending anything on which you would legitimately for..in loop (not Object, not Array, even though it's been argued that for..in over an array is bad practice also).
Hope this helps understand the issue.