Wednesday, March 21, 2012

ajax and clientsidescript

Hello, just a question, we have a page that is ajax enabled, when the user clicks on the button a email is sent to him and then a javascript message popups saying that the email was sent.

The problem is that when we are using ajax and it posts back, we dont get the messagebox. I have tried both:

ClientScript.RegisterStartupScript(mType,

"emailError","<script language=\"Javascript\" type=\"text/javascript\">alert('Email gesendet');</script>");

ClientScript.RegisterClientScriptBlock(mType,

"emailUncheck","<script language=\"Javascript\" type=\"text/javascript\">uncheckAll();</script>");

None of the above happens when the page was posted back using ajax update panel. How do you send javascript back to the client when you are using ajax?

Patrick

Hi,

to inject custom scripts when using ASP.NET AJAX, you should rely on the RegisterXXX methods exposed by the ScriptManager control.


perfect thanks

No comments:

Post a Comment