Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep label and input together in horizontal CheckBoxList

Status
Not open for further replies.

may1hem

Programmer
Jul 28, 2002
262
GB
I have a CheckBoxList, with RepeatDirection set as "Horizontal" and RepeatLayout set as "Flow". I'm finding that the label and input (checkbox) don't stay together at the end of a line. So I end up with the checkbox on the previous line and the label on the next line, which isn't good.

I'm adding items to the CheckBoxList in the Page_Load code:
Code:
Checkboxlist1.Items.Add(arr(i).ToString)

I'm aware that it would be possible to keep the checkbox and label together if I could add <nobr> tags around them, but I can't find a way to do that. The HTML code generated just has <input> and <label> tags repeating. So I can't even apply a CSS alternative to <nobr>, which I read would be "white-space:nowrap".

Any ideas how I can keep each checkbox and label pair together, and prevent them from separating over 2 lines?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top