Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok guys this is really stupid, and my mind just stuck now (after about 19 hours of straight coding)

 

Why on earth do i have to click two times the button to write/load the session variable??? and how can i solve it

 

the following is a simple example of what i mean, the actual code is quite long :)

 

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

       If IsPostBack Then
           TextBox1.Text = Session("Test")
       End If
   End Sub

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Session("Test") = TextBox2.Text
   End Sub

 

 

I write something to textbox 2 and then i have to press twice to come up in textbox 1 ... please help guys..

 

thanks

Posted
The Page_Load fires before the Button_Click event' date=' you are only assigning the string to the session after it has run the page_load event.[/quote']

 

Any suggestions ?

Posted

that's not the point ;-)

as i mentioned this a simple implementation of a much more complex application.

 

This server variable is controled by a number of other controls and the central page decides which controls to load based on this variable. I found a solution using the pre render event which is executed right before the rendering

 

thanks a log guys

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...