Hi there
i have this code:
Code:
ProtectedSub CustomValidator1_ServerValidate(ByVal source AsObject, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
args.IsValid = True
ForEach drv As DataRowView In SqlDataSource1.Select(DataSourceSelectArguments.Empty)
If drv("Name").ToString() = args.Value Then
args.IsValid = False
ExitFor
EndIf
Next
If args.IsValid Then
Me.Response.Redirect("send.aspx")
'Else
' Me.LblErrorMessage.Text = "Name Exsists"
EndIf
EndSub
ProtectedSub btnNext_Click1(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnNext.Click
'Response.Redirect("~/Send.aspx")
EndSub
every thing works in this page but when i navigate to send.aspx i cant find the controls from this page.
if i use postbackurl i see the controls but the validation does not occur.
i use this to fined the controls in send.aspx:
Code:
IfNot Page.PreviousPage IsNothingThen
Dim txtName As TextBox
Dim txtEmail As TextBox
Dim WorkName As TextBox
Dim Leadsorce As TextBox
Dim ListBox1 As ListBox
txtName = CType(PreviousPage.FindControl("txtName"), TextBox)
txtEmail = CType(PreviousPage.FindControl("txtEmail"), TextBox)
WorkName = CType(PreviousPage.FindControl("WorkName"), TextBox)
Leadsorce = CType(PreviousPage.FindControl("Leadsorce"), TextBox)
ListBox1 = CType(PreviousPage.FindControl("ListBox1"), ListBox)
i need to be able to click the next button the validation occurs and if the name does not exsist go to next .
at the moment everything works if i don't go to send.aspx.
thanks