RadEditor will usually be used as a replacement for the regular TextBox control which offers support for validators such as <asp:RequiredFieldValidator> and <asp:CustomValidator>. The example demonstrates how to attach <asp:RequiredFieldValidator> and <asp:CustomValidator> controls to RadEditor:
<telerik:radeditor runat="server"ID="RadEditor1"></telerik:radeditor>
<asp:RequiredFieldValidator ID="ResumeValidator" Runat="server"
ControlToValidate="RadEditor1"
Display="Static">Please fill in your RESUME!!!
</asp:RequiredFieldValidator>
<asp:CustomValidator runat="server" ID="CustomValidator1"ControlToValidate="RadEditor1" ClientValidationFunction="checkLength">* Your resume is too short. Its length should be at least 50 symbols.</asp:CustomValidator>
<script type="text/javascript">
var limitNum = 50;
function checkLength(sender, args)
{
//Note that sender is NOT the RadEditor. sender is the <span> of the validator.
//The content is contained in the args.Value variable
var editorText = args.Value;
args.IsValid = editorText.length > limitNum;
}
</script>
Note: The CustomValidator tends to fire its ClientValidationFunction only if the textbox (or editor) it validates has some content. Thus, a RequiredFieldValidator is needed in addition to the custom validator so that the empty text case can be captured.