Creating Counter
How can I create a counter on a webpage?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pramod Kumar NandagiriPosted Feb 23, 2012, 1:29 AM
if my assumption is right? then below is the code
page_load
{
if(!ispostback)
{
viewstate["count"]=0;
}
}
button1_click
{
//for every post back the count will be increased by 1
viewstate["count"]=(int) viewstate["count"]+1;
// below line gives the total count of postbacks
int count=convert.toint32( viewstate["count"])
}