Click here to Skip to main content
15,917,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All
i want to count click in datalist link
Exaplain
i have one webpage where a datalist control
and i m populating to database
now i want when user clcik any link on datalist then
count the hits
if user click asp.net link then count
if user click any link then count.
i mean i want to know how many time
user visits the link
Posted

1 solution

If you are using asp:Hyperlink for your links in the datalist, then I guess you can't count the hits. A hyperlink has no server side click event, therefore you won't be able to post back to record the hits. You can however, use a LinkButton and then on the click event of the control, you can do some logic like increment a variable that keeps tracks of your hits, and then use Response.Redirect. You can store it in a data store, a database for example. The drawback for using LinkButton is, it might cause a slow down because you are posting back to the server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900