Does jQuery work when you first load the page, and then it stops
working after any ajax postback within the update panel?  If this is
the case there is a pretty simple fix:

instead of using $(document).ready(function() { ...});
use either:
function pageLoad() {
   //code goes here
}

or

Sys.Application.add_load(function() {
   //code goes here
});

The first can be used if you only need one function call, the latter
is for adding multiple function calls to a page load.  I recommend the
latter, since you never know when you may want to separate some js/
jQuery into different external files.  The problem is that jQuery
binds its events to everything the first time the page loads, and then
the update panel sends the entire section of html code within it to
the server, and then a new set of html code is returned.  This means
that all of the events are no longer bound to the new controls inside
the update panel.  In theory you may alternately be able to use $
("#element).live("click"... but I've never tested it.

If you have more questions, email me I don't always have time to check
this list. (shawn.so...@gmail.com)
Thanks,
Shawn

On Dec 23, 3:42 pm, Leonardo Balter <leonardo.bal...@gmail.com> wrote:
> Maybe the asp.Net ajax is still working and changing elements when the DOM
> is ready in the page.
>
> I would encourage you to get rid of your asp.net ajax too. It's a nightmare
> of issues.
>
> 2009/12/23 Šime Vidas <sime.vi...@gmail.com>
>
> > Well, it actually gets even shorter... you can combine the two
> > selectors into one....
>
> > jQuery("#TreeviewTd, #MenuBarTd").toggle();
>
> > I have no experience with the UpdatePanel, but I encourage you to get
> > rid of all other AJAX libraries and stick to jQuery...
>
> > Can you tell me why jQuery(document).ready(function(){...}); doesn't
> > work when UpdatePanel is present?
>
> --
> At,
> Leo Balterhttp://leobalter.net
> Blog técnico:http://blog.leobalter.net

Reply via email to