Asterix (*) on required fields

Posted on 2006-05-11
Last Modified: 2008-02-01
Hi All,

Im hoping this is super easy.

I have some webforms ( which contain some required fields.  I check these with the following tag (example)

<asp:RequiredFieldValidator id="valRequired" runat="server"  Display="Static" ControlToValidate="proposer_surname"
                               ErrorMessage="Please Enter your Surname" >*</asp:RequiredFieldValidator>

Which is all great - and displays a lovely red asterix(*) when the fierld is blank.  However, I would like to mark these fields with a non-red asterix before the form is validated - to indicate they are required fields, and have the asterix turn red on validation failure.

I had assumed this is what the Display="static" property would do - but i now see this just reservrs space for the control (i had it set to dynamic previously).

So my question is there a simple way of doing this - or do i have to manualy code an asterix to appear on first load and disappear on post  backs?


Question by:peteSK
    1 Comment
    LVL 11

    Accepted Solution

    I think it has to be done manually, I don't think there is a pre-built control for that.  I have an image that is simply located next to all required fields.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now