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.
精彩评论