I want to extend RadTextBox by implementing RequiredFieldValidator. I did simillar functionality with asp:textbox :
When I want to inherit from RadTextBox (at line 2: Inherits Telerik.Web.UI.RadTextBox), code stops working with weird error:
What I'm doing wrong? Thank you for your help!
Zdenek
Public Class MyTextBox |
Inherits WebControls.TextBox |
Private req As New RequiredFieldValidator |
Protected Overrides Sub OnInit(ByVal e As EventArgs) |
req.ControlToValidate = Me.ID |
req.Display = ValidatorDisplay.Dynamic |
req.ErrorMessage = "Please fill marked field(-s)" |
req.Text = "*" |
req.EnableClientScript = True |
Controls.Add(req) |
End Sub |
Protected Overrides Sub Render(ByVal w As HtmlTextWriter) |
MyBase.Render(w) |
req.RenderControl(w) |
End Sub |
End Class |
When I want to inherit from RadTextBox (at line 2: Inherits Telerik.Web.UI.RadTextBox), code stops working with weird error:
Unable to find control id 'txtTest' referenced by the 'ControlToValidate' property of ''.
What I'm doing wrong? Thank you for your help!
Zdenek