开发者

How to implement a counter in label which decrements every time page is loaded in asp.net(vb)?

How to implement a counter in label which decrements every time page is loaded in asp.net(vb)? It would be better if that counter value is accessed from and updated into database..

I've tried this on buttonclick but the value is reset automatically to initial value every time as the button is insert and page is reloaded

Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventAr开发者_开发知识库gs)
        Dim entries As Label = FindControl("label1")
        entries.Text = entries.Text - 1
End Sub


You'll need to store that value in session, or a database, or a cookie. You also need need to set the value (Page_Load would be a good start) each time your web form is loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜