Search code examples
c#asp.netwebformsmaster-pages

Uncaught ReferenceError: __doPostBack is not defined


I am trying to execute a onserverclick but get the following error

Uncaught ReferenceError: __doPostBack is not defined

This is my button

<input type="button" runat="server" style="padding:5px;" id="butSearch" onclick="if(!ManageCat())return;" onserverclick="butSearchCat_Click" value="Search" />

protected void butSearchCat_Click(object sender, EventArgs e)
{

}

Why do I get this error and is there a fast way of overcoming this.

Thanks


Solution

  • Add __doPostBack('SearchCat','') to your onclick

    Try it as below:

     <input type="button" runat="server" style="padding:5px;"
     id="butSearch"
     onclick="if(!ManageCat())return;__doPostBack('SearchCat','')"
     onserverclick="butSearchCat_Click" value="Search" />