Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Managing state between postbacks to server
Message
General information
Forum:
ASP.NET
Category:
Web forms
Miscellaneous
Thread ID:
00640625
Message ID:
00640715
Views:
19
1)Why does your Page_Load event use Handles and Page_Prerender does not?
2)Try peristing to session instead of viewstate, just to see if it will work.
3)The sequence of event firing is page init, page load, control changed, page render.



>I have a web form that has to post back to the server to refresh a combo box depending on what the user has selected in another combo box. I need the ability to save a couple of variables when this is done.
>
>According to the book I have (and I know I got this to work using Beta 2) - this is the code I need using 'ViewState' to get this to work:
>
>
>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
>        If Not IsPostBack Then
>            strTableName = "blah"         ' for testing purposes
>            strDatabaseName = "Blah,Blah" ' for testing purposes
>            Call FillDBCombo()
>            Call FillTableCombo()
>        Else
>            strTableName = ViewState("strTableName")
>            strDatabaseName = ViewState("strDatabaseName")
>        End If
>    End Sub
>
>    Sub Page_PreRender(ByVal Sender As Object, ByVal E As EventArgs)
>        ViewState("strTableName") = strTableName
>        ViewState("strDatabaseName") = strDatabaseName
>    End Sub
>
>
>
>However, when it does a postback, it resets the variables to empty strings. Any idea whay I'm missing here - or is there a better way to do this ?
>
>Thanks in advance,
>
>Al
Previous
Reply
Map
View

Click here to load this message in the networking platform