labels in checkboxlist wrapping, why?

Posted on 2005-03-10
Medium Priority
Last Modified: 2008-01-09
On two different .aspx pages I have checkboxlist controls.  On both pages I databind the list to to the results of query and all works, except that on 1 page the labels on the checkboxes in the list wrap, but not on the other one?!?!

How do you prevent the text from wrapping?  I can't find a property anywhere....why would one wrap and the other not?

Question by:backwaterdogs
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
LVL 11

Expert Comment

ID: 13513518
Can you post the code?


Accepted Solution

mppeters earned 2000 total points
ID: 13517850
There's no real simple way to prevent it from wrapping, since for some silly reason, you can't set a cssclass for each ListItem in a RadioButtonList.

One workaround I can think of is to set a cssclass for the entire radiobuttonlist and have css do the rest of the work to find the <label> tag for each radiobutton.

For example:
<asp:radiobuttonlist id="YesNoRBL" runat="server" cssclass="inputlist" repeatdirection="Horizontal"      cellpadding="0" cellspacing="0">
<asp:listitem value="N">No</asp:listitem>
<asp:listitem value="Y">Yes</asp:listitem>

Then in your style sheet:

.inputlist {
   /* nothing really needed here */
.inputlist label {
      white-space: nowrap;

And just for good measure:
If you want to eliminate extra padding if your radiobuttonlist is contained within a parent table. You can do this:

.inputlist input {
         width: 15px;
      height: 15px;
      margin: 2px 2px 2px 0px;
      padding: 0;
      vertical-align: middle;

.inputlist label {
      margin-right: 4px;
      white-space: nowrap;

Expert Comment

by:Joel Parmer
ID: 20732827
Awesome!  Thanks.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

741 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