C
-=Chris=-
I'm developing a custom server control that will be rendering a form based
on some input. I've tried creating custom validators in vb.net like so:
Dim v1 as RequiredValidator = new RequiredValidator()
Dim vs as ValidationSummary = new ValidationSummary()
RequiredValidator.ControlToValidate = "id of form control here"
RequiredValidator.Enabled = True
RequiredValidator.EnableClientScript = True
RequiredValidator.ErrorMessage = "Test message"
ValidationSummary.ShowSummary = False
ValidationSummary.ShowMessageBox = True
ValidationSummary.EnableClientScript = True
ValidationSummary.Enabled = True
Now when I submit the form, I have a piece of code in the button's onclick
event that does:
Response.Write "Page Validity: " & Me.IsValid
When the fields are not filled in properly, me.IsValid returns false as
expected, but the ValidationSummary never displays the messagebox. It's
almost like the validation controls have to be registered with the
validation summary somehow, and that's not happening.
Any ideas? What am I missing?
Thanks in advance,
Chris
on some input. I've tried creating custom validators in vb.net like so:
Dim v1 as RequiredValidator = new RequiredValidator()
Dim vs as ValidationSummary = new ValidationSummary()
RequiredValidator.ControlToValidate = "id of form control here"
RequiredValidator.Enabled = True
RequiredValidator.EnableClientScript = True
RequiredValidator.ErrorMessage = "Test message"
ValidationSummary.ShowSummary = False
ValidationSummary.ShowMessageBox = True
ValidationSummary.EnableClientScript = True
ValidationSummary.Enabled = True
Now when I submit the form, I have a piece of code in the button's onclick
event that does:
Response.Write "Page Validity: " & Me.IsValid
When the fields are not filled in properly, me.IsValid returns false as
expected, but the ValidationSummary never displays the messagebox. It's
almost like the validation controls have to be registered with the
validation summary somehow, and that's not happening.
Any ideas? What am I missing?
Thanks in advance,
Chris