开发者

is there any method for know on which hyperlink user has clicked in asp.net?

hi actually i want to store value that has been clicked by user on web page for instance.

suppose this is my web page content of list

**

**go开发者_如何学Google.com**
**yahoo.com**
**facebook login**
**stackoverflow.com**

**

now suppose user click on facebook login 

then how to know that user has clicked on facebook login actually i want to keep record for further processing.


Abatischev's suggestion will work, but there's an easier method that doesn't involve making AJAX calls if you don't want to go through the hassle.

Instead of having the link go directly to the page that you're linking to, you should have it submit to your asp.net page. You can then record the click there before redirecting to the destination page.


Client-side way:

Before finish the page render, add programmatically onclick event to each hyperlink, call on click an async JavaScript script to record url

Server-side way: (extending @Justin's answer)

<asp:LinkButton runat="server" OnClick="urlGoogle_Click">google.com</asp:LinkButton>

protected void urlGoogle_Click(object sender, EventArgs e)
{
    DataBase.Record("google.com");
    this.Response.Redirect("http://google.com");
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜