This has not happened to me before, but for some reason server side validation events are not being triggered: I'm using Code below
<asp:CustomValidator runat="server" id="RefId" OnServerValidate="Ref_Id" ControlToValidate="txtRefId" ErrorMessage="Referral ID is Required." ></asp:CustomValidator>
When I fix the debugger on below code that time the code will not be triggered. plz check below code also.
Protected Sub Ref_Id(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
Dim isPresent As String
isPresent = MembershipManager.IsReferalApproved(Me.txtRefId.Text)
If isPresent <> "" Then
addReferralName()
args.IsValid = True
Else
lblRefNotValid.Text = "Referral IDNO does not exist."
lblRefNotValid.Visible = True
Me.txtRefName.Text = ""
args.IsValid = 开发者_如何学编程False
End If
End Sub
your custom validator's control should have the property ValidateEmptyText = True or the validation won't trigger on an empty textbox
Does your txtRefId Autopostback and CausesValidation?
精彩评论