Use Sql Database and Make Table Named "Counter" Make a new Column Name for e.g "PostViewed" and "PostNumber"
and on Page load use this type of Logic.
Read data by SqlReader About the Post and also read PostViewed column Query will be like "SELECT * FROM Counter Where PostNumber = '" + TakePostNumber + "' then increment +1 and store UPDATE PostViewed the incremented Value, and then you will resolve your
issue..
misteraddi
Member
54 Points
103 Posts
hit counter
Jun 27, 2012 09:29 AM|LINK
i want a code to will count and show the number of viewers to a post on a page once the link has been clicked
kedarrkulkar...
All-Star
34013 Points
5468 Posts
Re: hit counter
Jun 27, 2012 09:33 AM|LINK
http://forums.asp.net/t/1758132.aspx/1
http://forums.asp.net/t/1570503.aspx/1
http://forums.asp.net/t/1700962.aspx/1
hope this helps...
</div>KK
Please mark as Answer if post helps in resolving your issue
My Site
MahadTECH
Star
8976 Points
1659 Posts
Re: hit counter
Jun 27, 2012 09:39 AM|LINK
Use Sql Database and Make Table Named "Counter" Make a new Column Name for e.g "PostViewed" and "PostNumber"
and on Page load use this type of Logic.
Read data by SqlReader About the Post and also read PostViewed column Query will be like "SELECT * FROM Counter Where PostNumber = '" + TakePostNumber + "' then increment +1 and store UPDATE PostViewed the incremented Value, and then you will resolve your issue..
its Logic.. hope you will resolve your issue soon
These links will help you!
Good luck`
Mahad Bin Mukhtar
Remember to Mark the replies as Answers
The easiest day was 'yesterday'.
MCP, MCSD
For .NET TECH Blog
Rishi Ganesh
Member
586 Points
123 Posts
Re: hit counter
Jun 27, 2012 09:46 AM|LINK
Hi Misteraddi,
Use as below
if(Application["HitCount"] != null) { Application["HitCount"] = 1; } else { Application["HitCount"] = (Convert.ToInt32(Application["HitCount"].ToString())+1); }You can control even in the Session Start of Global.asax or from the Login Form
sumitacc
Member
185 Points
53 Posts
Re: hit counter
Jun 27, 2012 10:07 AM|LINK
for your requirement i suggest you to use Application Variable and when the button is clicked inrease the value of Application Variable by one
or
you can use database make column with no of viewers and update that value by increasing one when the button is clicked.
Software Developer
India