Advertisement

05.24.2008 at 01:57PM PDT, ID: 23430343
[x]
Attachment Details

Getting the asp:RadioButtonList to horizontally align items

Asked by PapaparaTudu in Cascading Style Sheets (CSS), Programming for ASP.NET, Internet Explorer Web Browser

Tags: Microsoft, ASP.NET, 2.0, radiobutton list rendering

Hi,
I am trying to align the output of the code below horizontally in one line. For some reason, in IE6 the items take up two lines and each item takes up 100% of the line width, while in FF 2, Opera 9 and Safari 3 they are all aligned in one line and do not take up any extra space.

As you can see, I'm using the asp:RequiredFieldValidator to validate the selection, and it works best with the asp:RadioButtonList, so I would like to use this control as opposed to looking for a workaround.

Any ideas why this is not working in IE?

 Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
<div class="divA">
                                    <div class="divB">
                                        <span class="labelA">Type of Item </span>
                                    </div>
                                    <div>                                                                        
                                        <asp:RadioButtonList ID="rblType" runat="server" RepeatColumns="2" RepeatLayout="Flow" RepeatDirection="Horizontal" CssClass="radioButtonList">
                                            <asp:ListItem>A sample item</asp:ListItem>
                                            <asp:ListItem>Some other item</asp:ListItem>
                                        </asp:RadioButtonList>
                                        <asp:RequiredFieldValidator ID="rfvItemType" Display="None" runat="server" ControlToValidate="rblType"
                                            ErrorMessage="<b>Required Field Missing</b><br />Please choose an item."></asp:RequiredFieldValidator>
                                        <ajaxToolkit:ValidatorCalloutExtender runat="server" ID="vcItemType" TargetControlID="rfvItemType"
                                            Width="250px" HighlightCssClass="highlight" />
 
                                    </div>
                                </div>
 
 
Here is the rendered html code:
                                <div class="divA">
                                    <div class="divB">
                                        <span class="labelA">Type of Item </span>
                                    </div>
                                    <div>                                                                        
                                        <span id="rblType" class="radioButtonList"><input id="rblType_0" type="radio" name="rblType" value="A sample item" /><label for="rblType_0">A sample item</label><input id="rblType_1" type="radio" name="rblType" value="Some other item" /><label for="rblType_1">Some other item</label></span>>
                                        <span id="rfvItemType" style="color:Red;display:none;"></span>
                                        <input type="hidden" name="vcItemType_ClientState" id="vcItemType_ClientState" />
 
                                    </div>
                                </div>
 
And here are the relevant parts of my css code:
 
.radioButtonList
{
}
 
.radioButtonList input[type="radio"]
{
	width: 20px;
    padding: 0;
    vertical-align: middle;	  
}
	
.radioButtonList label
{
	margin-right: 4px;    
    white-space: nowrap;
}
 
.divA
{
	clear: both;
	margin-bottom: 30px;
}
 
.divB
{
	float:left;
}
 
.labelA
{
	text-align: left;
	float: left;
	width: 180px;
	font-size: 10pt;
	font-weight: 600;
}
[+][-]05.24.2008 at 02:12PM PDT, ID: 21640255

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 02:35PM PDT, ID: 21640316

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 03:15PM PDT, ID: 21640422

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 03:33PM PDT, ID: 21640469

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 03:48PM PDT, ID: 21640499

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cascading Style Sheets (CSS), Programming for ASP.NET, Internet Explorer Web Browser
Tags: Microsoft, ASP.NET, 2.0, radiobutton list rendering
Sign Up Now!
Solution Provided By: third
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.25.2008 at 05:55AM PDT, ID: 21642412

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 06:28AM PDT, ID: 21642559

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.27.2008 at 08:09AM PDT, ID: 21652498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628