开发者

Calling a Javascript Function on LoginError Event

开发者 https://www.devze.com 2023-01-14 04:07 出处:网络
I have an ASP.NET login control placed within a simple JavaScript popup modal that I developed.I then have the modal in an update panel so that I can get a response from the server on successful login

I have an ASP.NET login control placed within a simple JavaScript popup modal that I developed. I then have the modal in an update panel so that I can get a response from the server on successful login. When the LoginError event fires I want to call a JavaScript function that displays the modal popup; as on the button press, the popup div disappears.

I basically need to know how to change the CSS display att开发者_如何学Cribute of an element within C# or how to call JavaScript within c#.


You could write a javascript function in your page that handles the display of the modal popup. Then, use something like this in the LoginError event:

ScriptManager.RegisterStartupScript(this.Page, yourUpdatePanel.GetType(), "AutoPostBackScript", "yourJavascriptFunction();", true);

If you are using jquery for your modal popup you will probably have a few more hoops to jump through to prepare the selectors. document.ready doesn't fire again after postback in an update panel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号