Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show asterisk in validation control but show error message in summary

I'd like a way to both show an asterisk by an invalid field and show a verbose message in a validation summary. However, setting Display to "NONE" in the validation control suppresses any message that would appear next to the field to validate.

Is there a way to get this kind of hybrid function?

like image 554
Caveatrob Avatar asked Jan 27 '26 21:01

Caveatrob


1 Answers

Yes.

Set the text property to "*" and the ErrorMessage property to the actual error message. Something like.

<asp:RequiredFieldValidator id="ValidateMyField" runat="server" text="*" 
errormessage="Hey, you must really specify something" 
controltovalidate="YourControl" />

For the display you can use display="Dynamic" to have the * only take up space on an actual error.

like image 81
Mitchel Sellers Avatar answered Jan 29 '26 10:01

Mitchel Sellers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!