ProperCasing fields in a GridView in C#

I have a C# ASP.Net 2.0 Gridview populated from a SQL stored procedure. The records in the database are mostly in ALL CAPS, and some are Proper Cased. I want to get ALL the fields to be Proper Cased in the GridView. I tried to do this with CSS, but it didn't work.

Some of the fields are BoundFields, and a couple are TemplateFields. How can I get them all ProperCased?
.salesdirgrid
{
    font-size: smaller;
    color: #1c66af;
    font-family: Tahoma, Verdana, Sans-Serif;
    background-image: none;
    text-transform: capitalize;
}
 
-----------------------------------------------------------
 
<asp:GridView id="gvResult" runat="server" Width="100%" CssClass="salesdirgrid" 
            AllowPaging="True" CellPadding="1" AllowSorting="True"
            OnRowDataBound="gvResult_RowDataBound" OnPageIndexChanging="gvResult_PageIndexChanging" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="Terr,Mkt,Agtno5,Fname,Lname,DBA,Street,City,State,Zip,Booth,EmplDate,TermDate,PrefPhone,Ceasar,County,ACT,Sat_Type">
			<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#1C66AF" />
			<FooterStyle ForeColor="#4A3C8C" BackColor="#1C66AF" />
			<PagerStyle HorizontalAlign="Left" ForeColor="White" BackColor="#1C66AF" />
            <Columns>
                <asp:BoundField DataField="Terr" HeaderText="T" ReadOnly="True" SortExpression="[Terr]" />
                <asp:BoundField DataField="Mkt" HeaderText="M" ReadOnly="True" SortExpression="[Mkt]" />
                <asp:HyperLinkField DataNavigateUrlFields="AgtNo5" DataNavigateUrlFormatString="http://road/aotemail/email.aspx?to=A0{0}@allstate.com&amp;body=Enter%20message%20here"
                    DataTextField="AgtNo5" HeaderText="Agent #" SortExpression="[Agtno5]" Target="_blank" />
                <asp:TemplateField HeaderText="First Name" SortExpression="[FName]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtFname" Text='<%# Bind("FName") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblFname" Text='<%# Eval("FName") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Last Name" SortExpression="[LName]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtLname" Text='<%# Bind("LName") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblLname" Text='<%# Eval("LName") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Agency Name" SortExpression="[DBA]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtDBA" Text='<%# Bind("DBA") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblDBA" Text='<%# Eval("DBA") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Street" SortExpression="[Street]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtStreet" Text='<%# Bind("Street") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblStreet" Text='<%# Eval("Street") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="City" SortExpression="[City]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCity" Text='<%# Bind("City") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblCity" Text='<%# Eval("City") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="State" HeaderText="St" ReadOnly="True" SortExpression="[State]" />
                <asp:BoundField DataField="Zip" HeaderText="ZIP" ReadOnly="True" SortExpression="[Zip]" />
                <asp:BoundField DataField="Booth" HeaderText="Booth" ReadOnly="True" SortExpression="[Booth]" />
                <asp:BoundField DataField="EmplDate" DataFormatString="{0:d}" HtmlEncode="false" HeaderText="Hire Dt"
                    ReadOnly="True" SortExpression="[EmplDate]" />
                <asp:BoundField DataField="TermDate" DataFormatString="{0:d}" HtmlEncode="false" HeaderText="Term Dt"
                    ReadOnly="True" SortExpression="[TermDate]" />
                <asp:BoundField DataField="PrefPhone" DataFormatString="{0:(###) ###-####}" HtmlEncode="false" HeaderText="Phone" 
                    ReadOnly="true" SortExpression="[PrefPhone]" />
                <asp:TemplateField HeaderText="Ceasar" SortExpression="[Ceasar]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCeasar" Text='<%# Bind("Ceasar") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblCeasar" Text='<%# Eval("Ceasar") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="County" SortExpression="[County]">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCounty" Text='<%# Bind("County") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblCounty" Text='<%# Eval("County") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="ACT" DataFormatString="{0:d}" HtmlEncode="false" HeaderText="ACT" SortExpression="[ACT]" />
                <asp:BoundField DataField="Sat_Type" HeaderText="Sat" ReadOnly="True" SortExpression="[Sat_Type]" />
                <asp:HyperLinkField DataNavigateUrlFields="AgtNo5" DataNavigateUrlFormatString="http://agent.allstate.com/{0}/welcome/"
                    HeaderText="Web" Target="_blank" Text="Web" />
                <asp:CommandField HeaderText="Edit" InsertVisible="False" ShowEditButton="True" ShowHeader="True"
                    Visible="False" />
            </Columns>
		</asp:GridView>

Open in new window

SeTechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
How does the page get rendered in HTML (View Source)?

I would think that if you applied the 'salesdirgrid' CSS class to RowStyle that it might help.

Bob
0
SeTechAuthor Commented:
I just checked, and it gets rendered as an HTML table.

I also tried applying the CSS 'salesdirgrid' drectly to the row, but though by the text size I could tell it had correctly applied to the rows, the text still isn't Proper Cased.
0
Bob LearnedCommented:
I hadn't use that text-transform style before, so I worked up a little test, and it worked fine:

        <table>
            <tr>
                <td class="class">this is a test of the radio broadcast system</td>
            </tr>
        </table>

This only worked is the class name was 'class'.  It wouldn't apply any styles, if I renamed the class to anything else (including the blue color), even though the designer showed it correctly.

Bob
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

SeTechAuthor Commented:
Hrmm, I gave that a try, but it still is showing most of my fields in ALL CAPS, even with the CSS class named "class".

Anything else?
0
Bob LearnedCommented:
Did you try it in a sandbox temporary, working project?  My sandbox test project is a Web Site model (no .csproj file), and not a Web Application model (.csproj file), if that makes any difference.

Bob
0
SeTechAuthor Commented:
No, I just tried to basically throw it to the wolves, so to speak.

This isn't an urgent requirement, but it looks kinda tacky for everything to be in ALL CAPS, can anything be done?
0
Bob LearnedCommented:
You might be able to use a casing method applied to the datasource:

System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(text)

Bob
0
SeTechAuthor Commented:
What I ended up doing was using a SQL Server built-in method as such :
dbo.Proper(FName) AS FName
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.