I am trying to find a validation library to validate user input on the server side
Basically, I would like to avoid the following code appearing 15-20 times per page :
If Not String.IsNullorEmpty(txtDate.text) Then
StrMsg.appendline("Please enter Date")
ElseIf Not IsDate(txtDate.text) Then
StrMsg.appendl开发者_如何转开发ine("Date must be numeric")
End If
I want to do something like this :
StrMsg.AppendLine(ValidateField(txtDate, SQLDataType.Date, Required))
Does anything like this exist?
You can use built in Validation controls
User Input Validation
Validation controls
After you have configured validation controls, all you have to do is check
Page.IsValid
精彩评论