Solved

How to capitalize the content of a an ASP textbox without posting

Posted on 2008-06-18
5
611 Views
Last Modified: 2013-11-26
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?
0
Comment
Question by:htabbach
  • 4
5 Comments
 
LVL 10

Expert Comment

by:Dxpert
ID: 21815404
I think that the easier way out here, would be to use, CSS:  text-transform: capitalize;
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;">
0
 

Author Comment

by:htabbach
ID: 21815747
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.
0
 
LVL 10

Expert Comment

by:Dxpert
ID: 21815870
<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" ;-)
0
 
LVL 10

Accepted Solution

by:
Dxpert earned 500 total points
ID: 21815881
Added quotes:
<asp:TextBox ID=txtId runat=server Text=ID style="text-transform: capitalize;"></asp:TextBox>
0
 
LVL 10

Expert Comment

by:Dxpert
ID: 21816670
Thanks! Glad I could help.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question