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

    Put an asterisk(*)in red color beside a textbox control


    I want to put an asterisk(*)in red color beside a textbox control which is mandatory field in a webpage.Can u please tell me how to do that. I will appreciate your help.

  • #355750

    In aspx page before that textbox add below line.

    <em id="mandatory" style="color:Red">*</em>


  • #355752
    Here's the code for .aspx file

    < asp:TextBox ID="YourId" runat="server" > < /asp:TextBox >
    < span style="color: red" > * < /span >

    Shreekumar. S. S
    Hobby web developer

    Specialized in ASP.Net 2.0, SQL Server 2000, C#, AJAX

  • #355759
    use the span tag where ever you want to put the red * like

    < span style="color: red" > * < /span >

    Thanks and Regards
    Miss Meetu Choudhary (Site Coordinator)
    Go Green Save Green

  • #355766

    this is another way to implement,

    place Requirefield validator control next to the each Textbox which are all mantatory,

    set following property in Requirefield validator control, thru property window(F4)

    errormessage = "*"
    controltovalidate = textboxname

    when you submit the value, if the value is missed in the text box, then it will display "*" in red color, as you expects.

    Hope it Helps!

    Note: Plz rate this answer, if it helped you!!

    Thanks and Regards,
    Babu Akkandi

This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.