RadInputManager with ValidationSummary

3 posts, 1 answers
  1. Lucania
    Lucania  avatar
    65 posts
    Member since:
    May 2011

    Posted 12 Apr 2012 Link to this post

    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. Answer
    Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lucania
    Lucania  avatar
    65 posts
    Member since:
    May 2011

    Posted 18 Apr 2012 Link to this post

    Thanks Vasil, that worked fine.
Back to Top