Solved

Force Uppercase in Label

Posted on 2006-11-28
4
835 Views
Last Modified: 2008-02-01
Hi,
I have a small question about formatting Label on an ASP.net page.

I use a sqldatasource to retrieve data from our oracle database,
on the page I put a datalist in which I bind the different fields returned by my query.

<asp:Label ID="CPLab" runat="server" Font-Bold="True" Font-Underline="True"
Text='<%# Eval("COMPANYNAME") %>' Font-Names="Times New Roman" Font-Size="11pt"></asp:Label>

One of the field comes from the database with the first letter in capital and others small.
I would like to force the label to display the whole field (all the letters) in uppercase.

By example, this give
Coca-cola -->COCA-COLA

and the same with lowercase
Thierry-->thierry

Acces databse gives ! to force uppercase, but I am unable to find the asp code.

thanks for your help
0
Comment
Question by:talentium
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 125 total points
Comment Utility
create a css class

.UpperCase
{
text-transform:uppercase;
}

apply this to your label and hey presto.
0
 

Author Comment

by:talentium
Comment Utility
Thanks for your reply,

I try this solution, but don't get it work
meaning

in My aspx page, I try this without success :

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Progress Report</title>

<style type="text/css">
.UpperCase
{
text-transform:uppercase;
}
</style>

</head>
<body>
<asp:Label ID="CPLab" runat="server" Font-Bold="True" Font-Underline="True"
Text='<%# Eval("COMPANYNAME") %>' Font-Names="Times New Roman" Font-Size="11pt" CssClass="uppercase"></asp:Label>
</body>
</html>



even with this
 <link rel="stylesheet" href="StyleSheet.css">

and putting your code in the css sheet

Any idea where I am wrong ?

Thanks
0
 
LVL 20

Expert Comment

by:REA_ANDREW
Comment Utility
you have this in your tag

uppercase

when your class is

UpperCase

Css Style attaching is case sensitive so the following will work.

<asp:Label ID="CPLab" runat="server" Font-Bold="True" Font-Underline="True"
Text='<%# Eval("COMPANYNAME") %>' Font-Names="Times New Roman" Font-Size="11pt" CssClass="UpperCase"></asp:Label>
0
 

Author Comment

by:talentium
Comment Utility
Thanks, it works
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now