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

RadInputManager with ValidationSummary

2 Answers 49 Views
Input
This is a migrated thread and some comments may be shown as answers.
Lucania
Top achievements
Rank 1
Lucania asked on 13 Apr 2012, 12:34 AM
Hi,

Is it possible for different text to be displayed in the TextBox and the ValidationSummary for a TextBox validated using TextBoxSetting? Reason for this is TextBoxes are restricted width, so I would like to display just "Invalid" in the TextBox, but more details of what is wrong in the ValidationSummary. I can only find ErrorMessage property, which seems to be used in both places.

Is this possible? Thanks.

Ross Crawford

2 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 16 Apr 2012, 03:02 PM
Hello Ross,

You could override the get_errorMessage of RadInputComponent to return something different from the original error message. Still the summery will show the original one, since it is set only once when the validators are created server side, and it is not get dynamically. Here is some example:

<asp:TextBox runat="server" ID="TextBox3"></asp:TextBox>
<telerik:RadInputManager runat="server">
  <telerik:DateInputSetting Validation-IsRequired="true" ErrorMessage="You should enter date into the textbox above">
    <TargetControls>
      <telerik:TargetInput ControlID="TextBox3" />
    </TargetControls>
  </telerik:DateInputSetting>
</telerik:RadInputManager>
<script type="text/javascript">
  Telerik.Web.UI.RadInputComponent.prototype.get_errorMessage = function ()
  {
    //return this._errorMessage;
    return "invalid";
  };
</script>
<asp:Button ID="Button1" Text="PostBack" runat="server" />
<asp:ValidationSummary ID="valSum" DisplayMode="BulletList" runat="server" HeaderText="Summary:" />

Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Lucania
Top achievements
Rank 1
answered on 19 Apr 2012, 04:03 AM
Thanks Vasil, that worked fine.
Tags
Input
Asked by
Lucania
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Lucania
Top achievements
Rank 1
Share this question
or