set focus after validation

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    393 posts
    Member since:
    Feb 2007

    Posted 24 Aug 2015 Link to this post

    How could I set focus on the Radrating after client-side validation like:




  2. Slav
    Slav avatar
    1359 posts

    Posted 27 Aug 2015 Link to this post


    If you want to focus RadRating when you use it in combination with a CustomValidator, for example if the validation fails, you can try the following approach:
    1. Set the TabIndex property of the rating control so that it can be focused:
      <telerik:RadRating ID="RadRating1" runat="server" TabIndex="1">
    2. Modify the body of the ValidateRating handler in order to include retrieving of the HTML element of the rating and focusing it. The following example shows how to do so when the validation fails:
      function ValidateRating(source, args) {
          args.IsValid = (args.Value > 0);
          if (!args.IsValid) {
              $find("<%=RadRating1.ClientID %>").get_element().focus();

    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