2

I have a custom form and I would like to add some functionality in my submit button. When I click on Submit button, I would like to close the popup and refresh the parent page.

I used this code in my button but there is a problem. It does not validate the controls and it makes a postback and even does not save any data.

OnClientClick="javascript:window.frameElement.commitPopup();"

Can you help me with some working code?

Thank you.

Dell Boy
  • 45
  • 3
  • 10

1 Answers1

2

You need to set OnClientClick property after the code you want to be executed.

   protected void btnAdd_Click(object sender, EventArgs e)
    {

                //Your Code here(some functionality)

                Context.Response.Write(@"<script type='text/javascript'>window.frameElement.commitPopup(); return false</script>");
                Context.Response.Flush();
                Context.Response.End();
    }
Ishan
  • 4,008
  • 32
  • 90
  • 153