views:

12

answers:

1

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 intial value everytime as the button is insert and page is reloaded

Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim entries As Label = FindControl("label1") entries.Text = entries.Text - 1 End Sub

A: 

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.

Coov
@Coov session worked fined.but still messing up in database..
Parth