Solved

Force Uppercase in Label

Posted on 2006-11-28
4
844 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
ID: 18027273
create a css class

.UpperCase
{
text-transform:uppercase;
}

apply this to your label and hey presto.
0
 

Author Comment

by:talentium
ID: 18030067
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
ID: 18035015
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
ID: 18035637
Thanks, it works
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 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