I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side.
How do we fix
What worked for me is moving the following code from page_load to page_prerender:
lstMain.DataBind();
Image img = (Image)lstMain.Items[0].FindControl("imgMain");
// Define the name and type of the client scripts on the page.
String csname1 = "PopupScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname1))
{
cs.RegisterStartupScript(cstype, csname1, "");
}