Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Managing state between postbacks to server
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Divers
Thread ID:
00640625
Message ID:
00640715
Vues:
20
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform