"onserverclick" does not work

I am trying to handle a click in a div in my code:

 <div id="divSearch" runat="server" class="box" onserverclick="aaa">Search</div> 

and

 protected void aaa(object sender, EventArgs e) { Response.Redirect("~/Search.aspx"); } 

It just doesn't work. Any ideas?

(I know this is not the best practice, but I'm just experimenting)

+1
html
source share
2 answers

There is no such "onserverclick" event in the div, you can try using various controls such as LinkButton, Button, etc.

0
source share

You can achieve this with Javascript and __doPostback.

Here is an example: __ doPostBack function

0
source share

All Articles