RegisterStartupScript in User Control causes Event Validation error

231 Views Asked by At

I have the following code in the code behind for a user control attached to a simple button click event. How do I avoid this cause an invalid postback? Its generating an Event Validation error.

protected void EditButton_Click(object sender, EventArgs e)
{
    PopulateEditControls();
    pnlEditDialog.Visible = true;

    Page.ClientScript.RegisterStartupScript(
       this.GetType(),
        "navigate",
        "window.onload = function()
              {window.location.hash='#editDialog';}",
       true);
}
0

There are 0 best solutions below