Incrementing variables in ASP.net on button click

后端 未结 7 1771
别跟我提以往
别跟我提以往 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:06

    @Rex M's suggestion for using Viewstate is good.

    If the counter is not sensitive information or something you're worried about someone tampering with., here's an easier idea:

    You can also use an and store the value there. Then it will persist between postbacks and you can increment it each time..

提交回复
热议问题