Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio Button List Layout ASP .Net [closed]

I'm having trouble achieving desired layout for radiobuttonlist. I want the output to look like the image below.

Here is a link to what I'm trying to achieve:

http://skitch.com/hiraldesai/fcfn9/radio-button-layout

Here is my code trying to achieve the above, but I am not able to get the text above the radio button programmatically. Is it a CSS thing? I have tried many different combinations of RepeatLayout, RepeatDirection, RepeatColumns, TextAlign, etc.

AnswerRadioButtons.RepeatLayout = RepeatLayout.Table
AnswerRadioButtons.RepeatDirection = RepeatDirection.Horizontal                            

Thanks for advising.

like image 340
Hiral Desai Avatar asked Jul 27 '11 19:07

Hiral Desai


People also ask

How hide RadioButtonList item in asp net?

Changes ("display", "none") to ("visibility", "hidden") to hide it.

How do I display a radio button list horizontally?

To make a horizontal radio button set, add the data-type="horizontal" to the fieldset .

What is the difference between radio button and radio button list in asp net?

An asp:radiobuttonlist creates a group of radiobuttons that ensures when one is selected, the others are deselected whereas asp:radiobutton is not within a group and therefore cannot be deselected by clicking other radio buttons.


1 Answers

I was able to do it with this test.

<asp:RadioButtonList ID="rbl" runat="server" RepeatDirection="Horizontal" 
        RepeatLayout="Table" CssClass="RBL" TextAlign="Left">
    <asp:ListItem Text="radio button 1" />
    <asp:ListItem Text="radio button 1" />
    <asp:ListItem Text="radio button 1" />
</asp:RadioButtonList>

With this css

.RBL label
{
    display: block;
}

.RBL td
{
    text-align: center;
    width: 20px;
}
like image 186
abney317 Avatar answered Oct 05 '22 13:10

abney317