Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to help a mate with his asp project he is trying to get a counter to update everytime you click the next button, i have set up a simplified version of his webform on my system... he is accessign a database record for the value of the count... that bit of his form works.. so i have left it off my mock up of his form... however when you click the button that updates the counter, the counter seems to reset as if the whole page is loading agian... the whole point of it is so that the page dynamically loads from a db.

 

here is the shortened code:

Public Class WebForm1

Inherits System.Web.UI.Page

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

 

#Region " Web Form Designer Generated Code "

 

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

 

End Sub

 

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

 

#End Region

 

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

 

 

End Sub

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Dim Counter As Integer

 

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Counter = Counter + 1

Label2.Text = Counter

End Sub

 

 

End Class

 

if anyone knows a way to get the count to stick then that would be great!

 

Cheers!

Hygor

Posted

I actually know nothing about ASP (as it is not my project)

 

what does that mean exactly and could you show me a sample code or something?

 

Thanks very much

Posted

Thanks mate, it worked a treat on my test page:D

am getting my mate to implement it now

 

once again you have been most helpful, ta very much!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...