Asterix (*) on required fields
Posted on 2006-05-11
Im hoping this is super easy.
I have some webforms (asp.net) 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?