views:

64

answers:

2

I am using JQuery to toggle the visibility of a in a webforms application. I am using an update panel to suppress the postback when my is clicked. What I would like to do when this is clicked is call the JQuery code that I use to toggle the once the postback has completed. What code(client-side or server-side) do I need to implement? Thanks you.

Edit:

I don't just need to fire the toggle event when the postback has completed, but when server-side code says that the user's input is valid.

A: 

Sure:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

This is a JavaScRipt callback. Just plug you handler in to toggle your code

Pierreten
Could you explain this a bit more? I'm unfamiliar with the PageRequestManager.
Achilles
It's a script object injected into the browser for dealing with asynchronous calls when using an update panel.
Pierreten
http://msdn.microsoft.com/pt-br/library/bb397432.aspx#MtViewDropDownText
Ciwee
This event fires when the page initially loads and seems to be disabling the other script I have in the page.
Achilles
+1  A: 

you can try this on server side:

if(<input is valid>)
{
ScriptManager.RegisterStartupScript(this.Page,this.Page.GetType(),"Toggle", "your javascript function call", true);
}

this will call your function when the postback completes

TeKapa
That's worked exactly the way I needed it to. Thank!
Achilles