Session Variable update problem

G

gce

I have two ASPX in my testproject :

1:

In the Page_load there is :

If Not Me.IsPostBack Then
Dim tfm
tfm = 30
Session("tfm") = tfm
Dim popupScript As String = "<script
language='javascript'>alert('Yes');</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End If

and there is the function that should change to value of tfm

Private Sub rlist1_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles rlist1.CheckedChanged
Dim tfm
tfm = Session("tfm")
tfm = 55
Session("tfm") = tfm
lblTotaal.Text = "gert" & Str(Session("tfm"))
End Sub


What happens : the lblTotaal will show me the 55 instead of the 30. But in
the next aspx the following returns the 30 again

If Not Me.IsPostBack Then
Dim tfm
tfm = Session("tfm")
Label1.Text = Str(tfm)
end if

PLEASE HELP ! What am I doing wrong,
 
D

David Lloyd

Gert:

This may be a ViewState issue, where the view state is changing the value of
the label to the old value. One suggestion would be to set the
EnableViewState property of the label to false.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top