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
Solved

Force Uppercase in Label

Posted on 2006-11-28
4
847 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.net Fit image buttons according to size of the screen 2 26
Reading the Web.Config using IIS 7.5? 4 49
Regex validation 2 28
Google Maps with Webforms 1 12
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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