views:

18

answers:

2

suppose I have a boolean function in my ValidationClass that checks user input for txtState (a textbox that contains the 2 letter abbreviation of a state), what should I put inside the if statement to activate Validation Summary displaying that user input for the state textbox is bad? Thank you!

if isState(txtState.txt) = false then
' not sure what goes here...
end if 
+1  A: 

Are you using a CustomValidator? If you do then it should roll up the message into the ValidationSummary automatically.

hunter
can you be a little more specific as to what "roll-up" means? how could it be done "automatically"? Thank you!
check out this article from 4Guys: http://www.4guysfromrolla.com/articles/073102-1.aspx
hunter
A: 

As Hunter said, this is a case for a CustomValidator. Attach a custom validator to your text box, set its ServerValidate method that verifies if the value in the text box is a state and voilà.

You can also add a JavaScript method to validate the state client-side so that it behaves the same way as your other validators.

GoodEnough