Hi,
i want to create a validatior via code behind.But although i create it,it doesnt fire when postback occurs.I craete validator in Page's Onload event.What can be reason?Here is my code.
Public Sub Validate(ByVal p_Page As Page, ByRef p_AssignedControl As System.Web.UI.WebControls.WebControl, ByVal p_Message As String)
Dim v_VCALLOUT As New AjaxControlToolkit.ValidatorCalloutExtender
Dim r_VALIDATOR As New System.Web.UI.WebControls.RequiredFieldValidator
Dim placeHolder As PlaceHolder = p_Page.FindControl("Vld")
With r_VALIDATOR
.ID = "r_" & p_AssignedControl.ID
.ControlToValidate = p_AssignedControl.ID
.Display = ValidatorDisplay.None
.ErrorMessage = p_Message
.Font.Name = "Verdana"
.Font.Size = FontSize.XSmall
End With
With v_VCALLOUT
.ID = "v_" & r_VALIDATOR.ID
'.CssClass = "highlight"
.HighlightCssClass = "highlight"
.WarningIconImageUrl = "~/images/warning.gif"
.CloseImageUrl = "~/images/close.gif"
.TargetControlID = r_VALIDATOR.ID
.Enabled = True
End With
placeHolder.Controls.Add(v_VCALLOUT)
placeHolder.Controls.Add(r_VALIDATOR)
End Sub