如何计算数据列表中的点击 [英] how can count hits in datalist
本文介绍了如何计算数据列表中的点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人
我想计算数据列表链接中的点击次数
依帕普林
我有一个网页,其中有一个数据列表控件
我正在填充数据库
现在我想要当用户点击数据列表上的任何链接时
计算点击数
如果用户单击asp.net链接,则计数
如果用户单击任何链接,则计数.
我的意思是我想知道多少时间
用户访问链接
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
推荐答案
如果您对数据列表中的链接使用asp:Hyperlink
,那么我想您就无法计算点击次数.超链接没有服务器端点击事件,因此您将无法回发记录命中.但是,您可以使用LinkButton
,然后在控件的click事件上,可以执行一些逻辑,例如增加一个变量来跟踪您的点击,然后使用Response.Redirect
.您可以将其存储在数据存储中,例如数据库.使用LinkButton的缺点是,由于要发回到服务器上,因此可能会导致速度变慢.
If you are usingasp: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 aLinkButton
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 useResponse.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.
这篇关于如何计算数据列表中的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文