I have an HTML button control and on click I want to call a asp.net button click event. I want to know how can I generate a click event handler in code behind?
when I am trying to do this in the Page_Load event:
btnSearch.Click += new EventHandler();
I get error:
btnSearch doesnot exist in the current context
Here is the HTML:
<input type="button" class="SmallButton ButtonSpacingAfter" value="Search" id="btnSearch" onserverclick="Button1_Click"/>
You need to convert it to a server side control by specifying runat="server" .
<input id="foo "runat="server" type="button" onserverclick="foo_OnClick" />