Incrementing variables in ASP.net on button click

后端 未结 7 1766
别跟我提以往
别跟我提以往 2021-01-24 16:25

I am new to asp.net. I am creating a ASP.net website using VB.net. So here\'s my problem

Dim myCounter as Integer = 0

Protected Sub Button1_Click(ByVal sender A         


        
7条回答
  •  遥遥无期
    2021-01-24 17:01

    You can use view count :---

    Code on event of button_click..

    ViewState["count"] = Convert.ToInt32(ViewState["count"])+1;
    Label2.Text = "This button has been clicked " + ViewState["count"].ToString() + " times";
    

提交回复
热议问题