'onserverclick' not working
I'm trying to handle a click within a div
in my code behind:
<div id="divSearch" runat="server" class="box" onserverclick="aaa">Search</div>
and
protected void aaa(object sender, EventArgs e)
{
Response.Redirect("~/Search.aspx");
}
开发者_如何学JAVA
It's simply not working. Any ideas?
(I know this isn't best practice but I'm just experimenting)
No such event "onserverclick" exist on div, you can try using different controls like LinkButton, Button etc...
You could achieve this with Javascript and __doPostback.
Here's an example: __doPostBack function
精彩评论