what is counter on webpage means? do u want to count the no of postbacks?
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"])
}