Set Focus to RadEditor with ASP RequiredFieldValidtor

2 posts, 0 answers
  1. Lee
    Lee avatar
    5 posts
    Member since:
    May 2009

    Posted 19 Feb 2016 Link to this post

    I am unable to set focus when a required field validator is fired for a RadEditor.

    I also have this issue to solve for a RadDatePicker and RadTimePicker.

    I found this but I have multiple RadEditors on the page only one o f which is a required field.

  2. Marin Bratanov
    Marin Bratanov avatar
    4655 posts

    Posted 24 Feb 2016 Link to this post

    Hi Lee,

    The linked forum thread offers an example that you can use as base to focus the editor.

    Note that required field validators do not focus the control they validate, you can see this with the following basic snippet:

    <asp:TextBox ID="Textbox1" runat="server" />
    <asp:RequiredFieldValidator ID="Requiredfieldvalidator1" ErrorMessage="errormessage" ControlToValidate="Textbox1" runat="server" />
    <asp:Button ID="Button1" Text="text" runat="server" />

    Since this is a feature of the validator, not of the editor, I advise that you use the client-side click event of the button to validate the page manually and execute any desired logic in a fashion similar to one of the last posts of Sleete's: You may also find interesting the following approach that lets you fire client-side validation and execute custom logic: (note the call to Page_ClientValidate(validationGroupName)). You can loop through the validators and focus the desired element with your own code then.


    Marin Bratanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top