tags:

views:

46

answers:

1

I am using this code.This pop up window pops up when I clicks a button on the main page.Now I want the pop up window to be closed if the password is successfully changed and reload the main page,but if the password is not changed then refresh the pop up window again. I used javascript for form validationenter code here Here is the code.....

<asp:Textbox id="curnt_paswrd" textmode="Password" runat="server" size="30" />
<asp:Textbox id="new_paswrd" textmode="Password" runat="server" size="30" />
<asp:button ID="btnChange" class="submit-button" 
          OnClientClick="return validate()" runat="server" Text="Change" 
          onclick="btnChange_Click" />
A: 

When you reload the that popup you can do something like this in script if the change was successful:

window.opener.location.reload();
window.close();

So for example using RegisterStartupScript:

ClientScript.RegisterStartupScript(GetType(), "CloseScript", 
  "window.opener.location.reload(); window.close();", true);
Nick Craver
where should I write the RegisterStartupScript??
Andy
@Andy - In the child page, as part of the success function, so in your `btnChange_Click` handler, *if* it was successful.
Nick Craver