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.
精彩评论