Reputation: 293
I am using the typical validator controls for required fields etc. On this form, the requirement is to transform the text to ALL CAPS as the user is entering their data. Again, no problem. However, once validation occurs, if there is an error, the data the user has entered thus far is repopulated in the form in the case in which it was entered - usually a mixture of upper and lower case. How do I force the text in the form to be repopulated in all upper case? Is there a client-side validation event I can use (since it all happens in the client side, there is no postback at this point)?
Upvotes: 0
Views: 301
Reputation: 103348
If you need all details to be in upper case, just let the user enter them in whichever form they wish. You can just use CSS to give the appearance of this being in uppercase:
text-transform:uppercase;
Then server-side, you can simply call txtMyTextBox.Text.ToUpper()
to convert the string.
Otherwise, if you rely on the client side, if they have javascript turned off for example, you may find lower case strings entering your system.
Upvotes: 3