You must Sign In to post a response.
  • Category: ASP.NET

    REgarding validation error message

    I have the following code in asp.net. and i want to display the error message inside the textbox. How to do that.

    <div class="panel-body">
    <div class="col-md-3 col-md-3">
    <!-- this is added by me -->
    <div class="form-group">
    <div class="input-group">
    <div class="input-group-addon"><span class="glyphicon glyphicon-user"></span> </div>
    <asp:TextBox ID="txtLrNo" CssClass="form-control" placeholder="Enter LR. No" runat="server">
    </asp:TextBox>

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="Validators"
    Display="Dynamic" ControlToValidate="txtLrno" ForeColor="#FF0000" runat="server" ErrorMessage="Lr No is Required."></asp:RequiredFieldValidator>

    </div>

    </div>

    <!-- upto here -->
    </div>
  • #769022
    Hi,

    I don't think so error or validation message will display in inside controls...!

    Usually it would display separate, I guess you want WaterMark to the text control? like "Enter LR No" inside textbox if yes then I suggest you to use AJAX WaterMarkExtender control this will help you to show the watermark by default to your textbox.

    Ex:

    <asp:TextBox ID="txtFstName" runat="server" CssClass="unwatermarked"></asp:TextBox>
    <ajaxToolkit:TextBoxWatermarkExtender ID="tbwe" runat="server" TargetControlID="txtFstName"
    WatermarkText="Enter First Name" WatermarkCssClass="watermarked"></ajaxToolkit:TextBoxWatermarkExtender>
    <br />


    Refer below link if you want to know more details on how to use WaterMarkExtender Control.

    http://www.dotnetspider.com/resources/45193-AJAX-Textbox-WaterMarkExtender.aspx

    Hope this helps you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments