Alerting the error messages.

2 posts, 0 answers
  1. Ivy
    Ivy avatar
    30 posts
    Member since:
    Feb 2013

    Posted 23 Jul 2013 Link to this post

    Hi 

    There are few input fields and required field validators and I tried to display the error message inside the control which is not completely possible due to browser related issues. So I thought of alerting the error messages on validation failed. But how can I get the error messages in javascript so that I can display them in an alert box? Is this a possible requirement?

    Thanks
    Ivy
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Nov 2013 Link to this post

    Hi Ivy,

    Please have a look into the code snippet to alert an error message of RequiredFieldValidator on validation failed.

    ASPX:
    <telerik:RadTextBox ID="TxtEmail" runat="server">
    </telerik:RadTextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtEmail"
        ValidationGroup="ValidationGroup1" ErrorMessage="TxtEmail Required">
    </asp:RequiredFieldValidator>
    <br />
    <telerik:RadTextBox ID="TxtPassword" runat="server">
    </telerik:RadTextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtPassword"
        ValidationGroup="ValidationGroup1" ErrorMessage="TxtPassword Required">
    </asp:RequiredFieldValidator>
    <br />
    <telerik:RadButton ID="RadButton1" runat="server" Text="Submit" ValidationGroup="ValidationGroup1"
        AutoPostBack="false">
    </telerik:RadButton>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="true"
        ValidationGroup="ValidationGroup1" />

    CSS:
    <style type="text/css">
        #RequiredFieldValidator1
        {
            display : none !important;
        }
      #RequiredFieldValidator2
        {
            display : none !important;
        }
        #ValidationSummary1
        {
            display : none !important;
        }
    </style>

    Thanks,
    Shinu.

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