How to provide space between First ListItem and Second ListItem in RadioButtonList ? in asp.net

Posted by Mahe under ASP.NET on 12/4/2012 | Points: 10 | Views : 11493 | Status : [Member] | Replies : 6
Hi,

How to provide space between First ListItem and Second ListItem in RadioButtonList ? in asp.net
cellspacing is giving above space for First ListItem, the first ListItem should be fixed at perticular position.


Regards,
Mahe




Responses

Posted by: Somu475 on: 12/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

You can use CSS to programmatically give space to whichever item in RadiobuttonList you want.

EX:
rblSampleRadioButtonList.Items(1).Attributes.CssStyle.Add("margin-left", "20px")


-Somu

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Somu475 on: 12/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

You can also do like this....

Use   to give space after the 1st item...

<asp:RadioButtonList ID="RblSample" runat="server" RepeatDirection="Horizontal">

<asp:ListItem Text="Item1&nbsp;&nbsp;&nbsp;&nbsp;" Value="Item1"></asp:ListItem>
<asp:ListItem Text="Item2" Value="Item2"></asp:ListItem>
</asp:RadioButtonList>

Mark as answer if it helps u....

-Somu

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/5/2012 [Member] Bronze | Points: 25

Up
0
Down
<asp:RadioButtonList ID="rb" runat="server" RepeatDirection="Horizontal" CellSpacing="30">
<asp:ListItem Text="Male" Value="M"></asp:ListItem>
<asp:ListItem Text="FeMale" Value="M"></asp:ListItem>
</asp:RadioButtonList>


use CellSpacing

Thanks
Pavan Kumar
Mark Answer if this fits the need

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 12/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Mahe,

Try Like This

<asp:RadioButtonList ID="rdblist" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Yes &nbsp &nbsp" ></asp:ListItem>
<asp:ListItem Text="NO"></asp:ListItem>
</asp:RadioButtonList>

Thanks & Regards
Hari

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 12/11/2012 [Member] Starter | Points: 25

Up
0
Down
U can use this by adding css class,
rdbtnId.Items[x].Attributes.CssStyle.Add("margin-right:5px;") Or U can specify &nbsp; for small spaces after text for eg:Text="Item0 &nbsp;&nbsp;"

Thanks & Regards

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimi1289 on: 8/29/2013 [Member] Starter | Points: 25

Up
0
Down
Class
.RadioButtonList  label {  margin-right:80px    }


HTML
<asp:RadioButtonList runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" RepeatColumns="2" CssClass="RadioButtonList">

<asp:ListItem Selected="True" runat="server" Text="L1" />
<asp:ListItem Selected="True" runat="server" Text="L2" />
<asp:ListItem Selected="True" runat="server" Text="L3" />
<asp:ListItem Selected="True" runat="server" Text="L4" />
</asp:RadioButtonList>


Cheers.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response