htabbach
asked on
How to capitalize the content of a an ASP textbox without posting
Hello,
I have a web application where call center reps enter information about the caller. They want the app to capitalize the first and last name after entering them. I made the text box post back and in the textChanged event I called this function:
txtFName.Text = StrConv(txtFName.Text, VbStrConv.ProperCase)
Works great. The problem is that users did not like the fact that the page posts everytime they exit the control. Is there a way to do the same on the client side without posting?
I have a web application where call center reps enter information about the caller. They want the app to capitalize the first and last name after entering them. I made the text box post back and in the textChanged event I called this function:
txtFName.Text = StrConv(txtFName.Text, VbStrConv.ProperCase)
Works great. The problem is that users did not like the fact that the page posts everytime they exit the control. Is there a way to do the same on the client side without posting?
ASKER
That would work but when I replaced my ASP textbox with an Input textbox and I declared the control in my VB.NET it fails and tells me that object is not set.
<asp:TextBox ID=txtId runat=server Text=ID style=text-transform: capitalize; Width=40px></asp:TextBox>
You can do it with Asp:textbox - it will render as input type="text" ;-)
You can do it with Asp:textbox - it will render as input type="text" ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks! Glad I could help.
Not sure it will work on all browsers. But It works on FireFox and IE 7
You can test it adding this to an html file.
<input type="text" name="txt" size="35" style="text-transform: capitalize;">