Hi everybody,
In my web form, I have declared a form level variable - vabc. I am trying to retain the value of the variable after a postback using ViewState. Following is my code:
VB Code:
Dim vabc as String Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Page.IsPostBack Then vabc = ViewState("vabc") Else vabc = "vParty01" End If End Sub Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload ViewState("vabc") = vabc End Sub
However, after a postback the value stored in ViewState("vabc") is lost. Why is it not retaining the value? What is the solution?




Reply With Quote