Validation Summary

5 posts, 0 answers
  1. MR
    MR avatar
    20 posts
    Member since:
    Dec 2011

    Posted 11 Apr 2014 Link to this post

    Hi,

    Does Telerik have anything similar to what DevExpress have on Custom Validation Summary Control. I am basically looking to have Hyperlinks on the Errors been displayed on the Validation Summary some of my forms are so long basically the user clicks on the hyperlink and puts a focus on the input field.

    Please let me know

    Thanks
  2. Orin Book
    Orin Book avatar
    54 posts
    Member since:
    Sep 2006

    Posted 22 Apr 2014 Link to this post

    I am also looking for same abilities of the hyperlink error message to control
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 25 Apr 2014 Link to this post

    Hello Orin,

    Is the approach suggested in my previous post working for you? If it is not, would you share your code and describe what seems to be the issue?


    Regards,
    Viktor Tachev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. MR
    MR avatar
    20 posts
    Member since:
    Dec 2011

    Posted 25 Apr 2014 in reply to Viktor Tachev Link to this post

    Notification popup won't work and not desired. I want the hyperlinks on the validation summary. The page needs to be accessed from both desktop and mobile devices.
  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 30 Apr 2014 Link to this post

    Hello Yassin,

    The approach I suggested for achieving such functionality was to use label elements in the ErrorMessage of a RequiredFieldValidator. The for attribute of the labels should be defined in a way that the validated TextBox is focused.

    Similar approach could be used if you prefer to use hyperlinks. You could generate the links dynamically using the Load event of the RequiredFieldValidator controls. To focus the associated input element you could use JavaScript to get reference to it and call focus().

    For example, the following could be the markup:

    <asp:TextBox runat="server" ID="TextBox1" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" OnLoad="RequiredFieldValidator_Load"  ControlToValidate="TextBox1" runat="server" />
    <br />
    <asp:TextBox runat="server" ID="TextBox2" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" OnLoad="RequiredFieldValidator_Load" ControlToValidate="TextBox2" runat="server" />
    <br />
    <asp:Button ID="Button1" Text="click" runat="server" />

    The handler for the Load event of the RequiredFieldValidator controls would look like below:

    protected void RequiredFieldValidator_Load(object sender, EventArgs e)
    {
        RequiredFieldValidator validator = sender as RequiredFieldValidator;
        Control validatedControl = this.FindControl(validator.ControlToValidate);
     
        string errorMessageString = "<a href=\"javascript: document.getElementById('" + validatedControl.ClientID + "').focus();\">Focus " + validator.ControlToValidate + "</a>";
        validator.ErrorMessage = errorMessageString;
    }

    Using this approach the links will also be shown when you include ValidationSummary control on the page.

    Regards,
    Viktor Tachev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017