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.

4

1 回答 1

2

您需要OnClientClick在要执行的代码之后设置属性。

   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();
    }
于 2012-09-20T12:21:05.267 回答