This following code handle button click event. When the user click first time it sets the lable as \"First Time\", and when the user click second time it sets the lable as \
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
Session["counter"]=0;
}
You set the counter value at once, when first the page loads.
protected void btnCompTagUpdate_Click(object sender, EventArgs e)
{
int counter=0;
if (Session["counter"]!=null)
counter= Convert.ToInt32(Session["counter"]);
if (counter == 0)
{
lable1.Text="First Time";
counter++;
Session["counter"]=counter;
}
else if (counter == 1)
{
lable1.Text="Second Time";
counter--;
Session["counter"]=counter;
}
}