Reputation: 23841
I was using the following script to call a javascript function only if my page in Edit Mode:
protected void Page_PreRender(object sender, EventArgs e)
{
if (EditMode)
ClientScript.RegisterStartupScript("".GetType(),
"EnableSelectableKey",
"EnableSelectableForRolesLists();",
true);
}
After I added an update panel, the script has not been called.
How to fix the problem?
Upvotes: 0
Views: 5743
Reputation: 24334
Using Sys.WebForms.PageRequestManager.endRequest
as Dave_Stott says is a cleaner way to do this (if there is such a thing as "clean" when talking about UpdatePanels
and client/server interaction). But you can also simply change your code to use ScriptManager
instead of ClientScript
and it should work:
ScriptManager.RegisterStartupScript("".GetType(),
"EnableSelectableKey",
"EnableSelectableForRolesLists();",
true);
Upvotes: 5
Reputation: 583
Have a look at: http://msdn.microsoft.com/en-us/library/bb383810.aspx
This should point you in the right direction :)
Upvotes: 1