Firstly let me apologise if this is such a simple issue but I am only just starting using Telerik controls. All of the controls we are making have to be server controls and I am having trouble finding sufficient documentation. I Cannot make these as a web control and that is all the examples I can find.
I have to make an address block as a server control using telerik radtextbox. This block has Address 1/2/3 City and Postcode and I need to validate what the user enters into the Postcode box.
I have added the text boxes with no problems - they work fine.
private RadTextBox _txtAddress1 = new RadTextBox();
private RadTextBox _txtAddress2 = new RadTextBox();
private RadTextBox _txtAddress3 = new RadTextBox();
private RadTextBox _txtCity = new RadTextBox();
private RadTextBox _txtPostcode = new RadTextBox();
(All have corresponding Public properties)
Once I start trying to work out How to validate the _txtPostCode I run into issues.
I thought I would declare _txtPostcode.RegularExpressionValidator but this is not a valid request.
I then declared a new RegularExpressionValidator.
_regularExpressionValidator.ID = "txtValidator";
_regularExpressionValidator.ErrorMessage = "Please enter valid Postcode";
_regularExpressionValidator.ValidationExpression ="^(([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}))$";
_regularExpressionValidator.ControlToValidate = "_txtPostcode";
setup the TextChanged and validation options of the _txtPostcode
_txtPostcode.TextChanged += new EventHandler(_txtPostcode_TextChanged);
_txtPostcode.AutoPostBack = true;
_txtPostcode.CausesValidation = true;
But I now cannot get to the point that the text box is validated.
Any help would be greatly received - code examples would be fantastic - I find that once someone has shown me a full example once I can then amend this as I need for future requirements as well
Many Thanks
Wendy