Thursday 8 November 2012

hit counter example in asp.net



<script type="text/javascript" runat ="server">
        protected void click(object sender, System.EventArgs e)
        {
            int clickCounter = 1;
            if (ViewState["ClickCounter"] == null)
            {
                clickCounter = 1;
            }
            else
            {
                clickCounter = (int)ViewState["ClickCounter"] + 1;
            }
            ViewState["ClickCounter"] = clickCounter;
            Label1.Text = "Button clicked " + clickCounter + " times.";
        }
          </script>

No comments:

Post a Comment