G
Guest
Hi all,
In the second web form, I have the following code: (The peopleinfo is a user
control which has name and ssn infomation, each field in this user control I
have set enableviewstate=true). I want to keep the peopleinfo control value
all there when customers click back or forth(continue). But my ctrlarr and
session("ctrlarr") was set up in submit_click sub, every time customer click
continue on the first page or click refresh on this page, the page is reload
and my data on this page are all gone. What should I do in this case?
Protected Peopleinfo0 As PeopleInfo
Protected Peopleinfo1 As PeopleInfo
Protected Peopleinfo2 As PeopleInfo
Protected Peopleinfo3 As PeopleInfo
Protected Peopleinfo4 As PeopleInfo
Protected Peopleinfo5 As PeopleInfo
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Submit1 As System.Web.UI.WebControls.Button
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Protected Sub Submit1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit1.Click
Dim ctrlarr(5) As PeopleInfo
Dim i As Integer
Dim errorFlag As Boolean = False
ctrlarr(0) = Peopleinfo0
ctrlarr(1) = Peopleinfo1
ctrlarr(2) = Peopleinfo2
ctrlarr(3) = Peopleinfo3
ctrlarr(4) = Peopleinfo4
ctrlarr(5) = Peopleinfo5
Label1.Text = ""
For i = 0 To 5
If ctrlarr(i).FirstName <> "" Then
If ctrlarr(i).LastName = "" Or ctrlarr(i).SSN = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).FirstName + " .<br>"
errorFlag = True
End If
End If
If ctrlarr(i).LastName <> "" Then
If ctrlarr(i).FirstName = "" Or ctrlarr(i).SSN = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).LastName + " .<br>"
If errorFlag = False Then
errorFlag = True
End If
End If
End If
If ctrlarr(i).SSN <> "" Then
If ctrlarr(i).FirstName = "" Or ctrlarr(i).LastName = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).SSN + " .<br>"
If errorFlag = False Then
errorFlag = True
End If
End If
End If
If ctrlarr(i).FirstName <> "" And ctrlarr(i).LastName <> "" And
ctrlarr(i).SSN <> "" Then
Session("depenFlag") = True
End If
Next
Session("ctrlarr") = ctrlarr
If errorFlag Then
For i = 0 To 5
Label1.Text &= ctrlarr(i).LastName + " " +
ctrlarr(i).FirstName + " " + ctrlarr(i).SSN + " .<br>"
Next
Else
Response.Redirect("EnrollReview.aspx")
End If
End Sub
In the second web form, I have the following code: (The peopleinfo is a user
control which has name and ssn infomation, each field in this user control I
have set enableviewstate=true). I want to keep the peopleinfo control value
all there when customers click back or forth(continue). But my ctrlarr and
session("ctrlarr") was set up in submit_click sub, every time customer click
continue on the first page or click refresh on this page, the page is reload
and my data on this page are all gone. What should I do in this case?
Protected Peopleinfo0 As PeopleInfo
Protected Peopleinfo1 As PeopleInfo
Protected Peopleinfo2 As PeopleInfo
Protected Peopleinfo3 As PeopleInfo
Protected Peopleinfo4 As PeopleInfo
Protected Peopleinfo5 As PeopleInfo
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Submit1 As System.Web.UI.WebControls.Button
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Protected Sub Submit1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit1.Click
Dim ctrlarr(5) As PeopleInfo
Dim i As Integer
Dim errorFlag As Boolean = False
ctrlarr(0) = Peopleinfo0
ctrlarr(1) = Peopleinfo1
ctrlarr(2) = Peopleinfo2
ctrlarr(3) = Peopleinfo3
ctrlarr(4) = Peopleinfo4
ctrlarr(5) = Peopleinfo5
Label1.Text = ""
For i = 0 To 5
If ctrlarr(i).FirstName <> "" Then
If ctrlarr(i).LastName = "" Or ctrlarr(i).SSN = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).FirstName + " .<br>"
errorFlag = True
End If
End If
If ctrlarr(i).LastName <> "" Then
If ctrlarr(i).FirstName = "" Or ctrlarr(i).SSN = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).LastName + " .<br>"
If errorFlag = False Then
errorFlag = True
End If
End If
End If
If ctrlarr(i).SSN <> "" Then
If ctrlarr(i).FirstName = "" Or ctrlarr(i).LastName = "" Then
Label1.Text &= "You need to complete information for
dependent " + ctrlarr(i).SSN + " .<br>"
If errorFlag = False Then
errorFlag = True
End If
End If
End If
If ctrlarr(i).FirstName <> "" And ctrlarr(i).LastName <> "" And
ctrlarr(i).SSN <> "" Then
Session("depenFlag") = True
End If
Next
Session("ctrlarr") = ctrlarr
If errorFlag Then
For i = 0 To 5
Label1.Text &= ctrlarr(i).LastName + " " +
ctrlarr(i).FirstName + " " + ctrlarr(i).SSN + " .<br>"
Next
Else
Response.Redirect("EnrollReview.aspx")
End If
End Sub