tags:

views:

26

answers:

1

I have an asp.net login control placed within a simple javacript popup modal that I developed. I then have the modal in an updatepanel 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 attribute of an element within c# or how to call javascript within c#.

A: 

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.

JasonS
I ended up reworking the problem to eliminate the postback, but this solves the question as asked.
Mel