This is a migrated thread and some comments may be shown as answers.

Validation Summary

5 Answers 170 Views
Input
This is a migrated thread and some comments may be shown as answers.
MR
Top achievements
Rank 1
MR asked on 11 Apr 2014, 01:14 PM
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

5 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 16 Apr 2014, 10:51 AM
Hi,

I am afraid that such control is not currently available, however you could achieve the functionality using standard ASP validation controls. In the ErrorMessage property you could add a label HTML element that is associated with the corresponding TextBox.

The markup would look similar to the one below:

<asp:TextBox runat="server" ID="TextBox1" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ErrorMessage='<label for="TextBox1">Focus TextBox 1</label>'  ControlToValidate="TextBox1" runat="server" />
<br />
<asp:TextBox runat="server" ID="TextBox2" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ErrorMessage='<label for="TextBox2">Focus TextBox 2</label>'  ControlToValidate="TextBox2" runat="server" />
<br />
<asp:Button Text="click" runat="server" />



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.

 
0
Orin Book
Top achievements
Rank 1
answered on 22 Apr 2014, 02:10 PM
I am also looking for same abilities of the hyperlink error message to control
0
Viktor Tachev
Telerik team
answered on 25 Apr 2014, 08:54 AM
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.

 
0
MR
Top achievements
Rank 1
answered on 25 Apr 2014, 12:09 PM
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.
0
Viktor Tachev
Telerik team
answered on 30 Apr 2014, 08:07 AM
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.

 
Tags
Input
Asked by
MR
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Orin Book
Top achievements
Rank 1
MR
Top achievements
Rank 1
Share this question
or