开发者

'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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜