Case change after page post

J

John

Hi

How can I change the case of the text entered by user to first letter
capital, after user has submitted the webform?

Thanks

Regards
 
E

Enrique Santa Cruz

You can use a function like so feel free to modify it to your needs.
private string Capitalizer(string text)

{

for(int i = 0; i < text.Length; i++)

{

if(Char.IsUpper(text) && i != 0)

{

text = text.Insert(i, " ");

i++;

}

}

return text;

}

Then right the value back to the text box before the post back of the page.
You can also store the value in a Session object then in the page load right
it to the textbox.

Enrique.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top