Show error message inside Textbox

2 posts, 1 answers
  1. Saira
    Saira avatar
    24 posts
    Member since:
    Feb 2013

    Posted 12 Mar 2013 Link to this post


    I am developing a web site to target mobile devices and So to save space i want to display error messages inside the Radtextbox if validation fails. Is this possible?

    Thank you,
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Mar 2013 Link to this post

    Hello Saira,

    Yes, its possible to display the error messgae inside the RadTextBox. Please have a look into the following code I tried.

    <telerik:RadTextBox ID="RadTextBox1" runat="server" EmptyMessage="Enter username">
    <telerik:RadTextBox ID="RadTextBox2" runat="server" EmptyMessage="Enter password">
    <asp:Button ID="Button1" runat="server" Text="PostBack" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text="username is required" ControlToValidate="RadTextBox1"
        Style="display: none;"></asp:RequiredFieldValidator>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Text="password is required" ControlToValidate="RadTextBox2"
        Style="display: none;"></asp:RequiredFieldValidator>

    <script type="text/javascript">
      ValidationSummaryOnSubmit = function (validationGroup) {
          for (var i = 0; i < Page_Validators.length; i++)
              if (!Page_Validators[i].isvalid) {
                  var textbox = $find(Page_Validators[i].controltovalidate);
                  if (textbox) {

  3. DevCraft R3 2016 release webinar banner
Back to Top