?
Solved

how to add a style to items within a CheckBoxList?

Posted on 2006-10-21
8
Medium Priority
?
550 Views
Last Modified: 2012-06-27
I have a CheckBoxList to which I wish to add a specific style from the css page to format the text size.
How do I achieve this?

I hjave tried adding the attribute 'CssStyle="txtSmall"' to the tag such as <asp:CheckBoxList CssStyle="txtSize" id="lbCostCenter" Runat="server" AutoPostBack="True" RepeatColumns="2" RepeatDirection="Horizontal"  width=100% />/>
But this does not work. It renders the page as <table id="lbCostCenter" class="txtSmall" border="0" style="width:100%;"> but the text for each CheckBox is the wrong size ie the css style is not applied.
If I try adding code to the cs page such as :
lbCostCenter.Attributes["CssClass"] = "txtSmall";
or
lbCostCenter.CssClass = "txtSmall";
but the result is exactly the same as the first attempt.

How do I force each <input ... />to read <input ... CssClass="txtSmall" />
0
Comment
Question by:spaceplanner
[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
  • 5
  • 3
8 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17780722
where u specify the style sheet? i mean the path..... first try copy this style class txtSize in your aspx page... then save close the application and restart it... check it is working or not
0
 

Author Comment

by:spaceplanner
ID: 17780749
Hi Roopesh,
I tried what you suggested but to no avail.
I do have the style defined in many other places in the app which all work fine. It is just this CheckBoxList that does not work
0
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17780772
hiii frd check box list is rendered in different format in out put thats y its not taken....so go through this link this defenitly help you

http://www.code-magazine.com/article.aspx?quickid=0503041&page=1

0
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.

 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17780776
hey give like this


asp:ListItem Value="<span
 class='txtSmall'>Maintenance Tasks</span>" />
<asp:ListItem Value="<span
 class='txtSmall'>Financial Tasks</span>" />
<asp:ListItem Value="<span
 class='txtSmall'>Corporate Tasks</span>" />
0
 

Author Comment

by:spaceplanner
ID: 17780864
Roopesh,
The article is very interesting but it doesn't seem to help.
As you can see from below I am able to insert the 'CssClass=txtSmall' into a ,span. but it has no effect.

Code:
alCostCenter.Add(new AddValue("<span CssClass=txtSmall >" + dsCostCenter.Tables[0].Rows[i][0].ToString()+ " - " + dsCostCenter.Tables[0].Rows[i][1].ToString() + "</span>",dsCostCenter.Tables[0].Rows[i][0].ToString()));                                                

Page source:                        
td><input id="lbCostCenter_3" type="checkbox" name="lbCostCenter:3" onclick="__doPostBack('lbCostCenter$3','')" language="javascript" /><label for="lbCostCenter_3"><span CssClass='txtSmall' >1234 - IT Support</span></label></td>
0
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17780900
use html control inted off aspx control
0
 
LVL 6

Accepted Solution

by:
Roopesh_7 earned 2000 total points
ID: 17780904
0
 

Author Comment

by:spaceplanner
ID: 17784730
what a bloody mess :P

thanks for all your help Roopesh.
My text will remain large for nwo ;)
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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

777 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