M
Markus Broy
Hello everybody,
I have a problem concerning the dynamic creation of a CustomValidator.
If I create a CustomControl as shown in the code below and the page is post
back the validation procedure is never called.
In Page_Load Page Validate() is called and in the control which should be
validated there is a non numeric value.
Why is the procedure "checkProd" never calles? What's wrong?
Here the code extract:
cell = New HtmlTableCell
txt = New HtmlInputText
txt.ID = "txt1"
val = New CustomValidator
val.EnableClientScript = False
val.Text = "*"
val.ErrorMessage = "Eingabe ungültig"
val.ControlToValidate = "txt1"
AddHandler val.ServerValidate, AddressOf checkProd
cell.Controls.Add(val)
...
Protected Sub checkProd(ByVal source As Object, ByVal args As
ServerValidateEventArgs)
If Not IsNumeric(args.Value) Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Thank you and best regards
Markus
I have a problem concerning the dynamic creation of a CustomValidator.
If I create a CustomControl as shown in the code below and the page is post
back the validation procedure is never called.
In Page_Load Page Validate() is called and in the control which should be
validated there is a non numeric value.
Why is the procedure "checkProd" never calles? What's wrong?
Here the code extract:
cell = New HtmlTableCell
txt = New HtmlInputText
txt.ID = "txt1"
val = New CustomValidator
val.EnableClientScript = False
val.Text = "*"
val.ErrorMessage = "Eingabe ungültig"
val.ControlToValidate = "txt1"
AddHandler val.ServerValidate, AddressOf checkProd
cell.Controls.Add(val)
...
Protected Sub checkProd(ByVal source As Object, ByVal args As
ServerValidateEventArgs)
If Not IsNumeric(args.Value) Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Thank you and best regards
Markus