如何验证textbox1和textbox 2。
- 波纹管代码是我只是验证日期大于或不是
的地方Private Sub cvCmpDate_ServerValidate(ByVal source As Object, ByVal args As ServerValidateEventArgs) Handles cvCmpDate.ServerValidate
If CompareMyDate.CompareDate(txtDateStart.Text.Trim, txtDateEnd.Text.Trim) Then
cvCmpDate.ErrorMessage = "* Activation Start Date cannot greater than Activation End Date."
args.IsValid = False
End If
End Sub
答案 0 :(得分:1)
Select Case True
Case String.IsNullOrWhitespace(txtDateStart.Text) AndAlso Not String.IsNullOrWhitespace(txtDateEnd.Text)
' Show Error
Case String.IsNullOrWhitespace(txtDateEnd.Text) AndAlso Not String.IsNullOrWhitespace(txtDateStart.Text)
' Show Error
Case CompareMyDate.CompareDate(txtDateStart.Text.Trim, txtDateEnd.Text.Trim)
cvCmpDate.ErrorMessage = "* Activation Start Date cannot greater than Activation End Date."
args.IsValid = False
End Select