开发者

'onserverclick' not working

开发者 https://www.devze.com 2023-04-02 07:32 出处:网络
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>

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

0

精彩评论

暂无评论...
验证码 换一张
取 消