As an asp.net developer we all must have to use update panel for the ajaxifying our application in today’s ajax world. No one likes postaback now. But when we add the some content with the java script under update panel then some times it’s stop working because of the update panel server side behavior. So what we should do? … Here is the trick. Normally we code java script in the asp.net page like following…
Technorati Tags: UpdatePanel,ASP.NET,C#.NET,VB.NET,Microsoft ajax
Instead of this you should use.string alertScript = "javascript:alert('Alter From asp.net page')";ClientScript.RegisterStartupScript(typeof(Page),"alertscript", alertScript);
This will work. Happy coding..string alertScript = "javascript: alert('This is aler from asp.net page')";ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript,true);
Technorati Tags: UpdatePanel,ASP.NET,C#.NET,VB.NET,Microsoft ajax
Its Working Now...
ReplyDeleteYou Releive me form a Big Torture...
Thank U So much..
Hey Buddy yeah u saved my day too.. thanks a lot
ReplyDeletewow, that's great article
ReplyDeleteits working now...
thanks for your info...
If the script is on the aspx page. How will we register that.
ReplyDeleteThanks in advance
for example you have javascript function foo() in your aspx page then you can register like this.
ReplyDeletestring alertScript = "javascript:foo();";
ClientScript.RegisterStartupScript(typeof(Page),"alertscript", alertScript);
Its very simple create a javascript function and register that.
Regards,
Jalpesh
Thanks a lot...
ReplyDeleteI'm getting a message in my C# codebehind function that calls the ScriptManager.RegisterStartupScript method that says the I 'Cannot access static method 'RegisterStartupScript' in non-static context'. Any ideas how to fix this?
ReplyDeletethank u soo much...........
ReplyDeleteThanks a lot..
ReplyDeleteGlad You liked it.. Thanks for putting comment!!
ReplyDeleteThank you very much Jalpesh!
ReplyDeletethansk alooooooottttttttttttt
ReplyDelete
ReplyDeleteThanks Faiq
thanks Mike
ReplyDeleteYou are welcome
ReplyDeleteMy problem no longer exists!!!
ReplyDeleteThanks!
ok thanks
ReplyDelete