Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it posible to run the ValidationGroup="RegisterUserValidationGroup" on page load?

because i have

ASP.NET
<asp:RequiredFieldValidator ID="RequiredFieldValidatortxtEmailAddress" 
            runat="server" ErrorMessage="*" ControlToValidate="txtEmailAddress" 
            ForeColor="#FF3300" ValidationGroup="RegisterUserValidationGroup">


Now on Page_load the error msg should appear
Posted
Updated 19-Oct-11 11:19am
v2
Comments
Mario Majčica 19-Oct-11 17:22pm    
What do you intend with "to run the"?
Msg of the validator should appear on the screen only when you try to commit the page (do a post back or other events, depending on validation control) and the validation rule is broken.
Anele Ngqandu 19-Oct-11 17:33pm    
on Page_Load...my textbox should show the star next to it. Then if the textbox has a value then the star should disappear

1 solution

As I understand it the "industry standard" is to show a '*' with mandatory fields.
Whether something is filled in the control does not change the fact that the field is mandatory.

The fact that the '*' is removed might make the user think the field is no longer mandatory and remove the data entered.

My advise would be to adhere to this "standard" and always show the '*' next to mandatory fields. Use the validator to give an error about the data entered in the field.
 
Share this answer
 
Comments
Simon Bang Terkildsen 19-Oct-11 18:35pm    
Good advice, I completely agree. +5
André Kraak 20-Oct-11 1:48am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900