Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Force Uppercase in Label

Posted on 2006-11-28
4
Medium Priority
?
883 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

705 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