Solved

how to add a style to items within a CheckBoxList?

Posted on 2006-10-21
8
510 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
  • 5
  • 3
8 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 6

Expert Comment

by:Roopesh_7
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:spaceplanner
Comment Utility
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
Comment Utility
use html control inted off aspx control
0
 
LVL 6

Accepted Solution

by:
Roopesh_7 earned 500 total points
Comment Utility
0
 

Author Comment

by:spaceplanner
Comment Utility
what a bloody mess :P

thanks for all your help Roopesh.
My text will remain large for nwo ;)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Gridview Edit Row 10 43
Combine two columns 3 37
Explain Unit of Work pattern 2 46
ASP.net VB.net hide footer cells of GridView 2 31
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

12 Experts available now in Live!

Get 1:1 Help Now