S
STom
I have several user controls where I am not using viewstate.
In the OnLoad, I call functions that will take the data out of the form
fields and save the data into a session object. Then I display what is in
the session object when the control is displayed to the client.
I have been reading about the control execution lifecycle and it seems that
PreRender might be of better use than the OnLoad event.
For example, if in the OnLoad event, I call SaveSessionData which does
something like:
If Not (Request.Form(Me.txtFirstName.UniqueID)) Is Nothing Then
Session("Person").FirstName =
Request.Form(Me.txtFirstName.UniqueID)
End If
and then call GetSessionData which does:
Me.txtFirstName.Text = Session("Person").FirstName
Is it not better to make the GetSessionData call in the prerender event?
BTW, the reason I have two separate functions to save and get the session
data is because in GetSessionData there are some other things I have to do
to set dropdowns etc.
Thanks.
STom
In the OnLoad, I call functions that will take the data out of the form
fields and save the data into a session object. Then I display what is in
the session object when the control is displayed to the client.
I have been reading about the control execution lifecycle and it seems that
PreRender might be of better use than the OnLoad event.
For example, if in the OnLoad event, I call SaveSessionData which does
something like:
If Not (Request.Form(Me.txtFirstName.UniqueID)) Is Nothing Then
Session("Person").FirstName =
Request.Form(Me.txtFirstName.UniqueID)
End If
and then call GetSessionData which does:
Me.txtFirstName.Text = Session("Person").FirstName
Is it not better to make the GetSessionData call in the prerender event?
BTW, the reason I have two separate functions to save and get the session
data is because in GetSessionData there are some other things I have to do
to set dropdowns etc.
Thanks.
STom