2016-02-14 52 views
0

我创建了一个radiobuttonlist,其中的项目是根据我的数据库动态生成的。我使用VB webform。如何在RadioButtonList中设置动态列表项目VB

在HTML中:

<asp:RadioButtonList ID="rdlSession" runat="server" CssClass="rdl"> 
</asp:RadioButtonList> 

VB:

For count = 0 To someitem.Length 'databaseitem 
     With rdlSession.Items 
      .Add(someitem) 
     End With 
Next 

enter image description here

我的问题是:
如何对齐行启动从红线?

(我一直在使用文本allign尝试:离开,但输出犯规影响很大,第一行中的单选按钮后出现。)

+0

将一个css类应用于单选按钮,并用css来完成。 – Mairaj

+0

是的,我已经尝试过了,但是在前面有第一个单选按钮的行将毁掉整个Allignment @MairajAhmad –

+0

你想要新行上的每个单选按钮? – Mairaj

回答

1

您需要css来解决这个问题。

RadioButtonList是(如果你看到Page Sourcetablerows哪里RadioButtons放置。

例如,在htmlRadioButtonList第一个项目将是(两个 “元素”:一个是<input type="radio" id="rdlSession_0" ...>labelinput):

<input id="rdlSession_0" type="radio" name="rdlSession" value="Session :0&lt;br>Date :0&lt;br>Coach :0&lt;br>Available slot :0" /><label for="rdlSession_0">Session :0<br>Date :0<br>Coach :0<br>Available slot :0</label> 

你需要应用一些csslabel

HTML

<asp:RadioButtonList ID="rdlSession" runat="server" CssClass="rdl"> 
</asp:RadioButtonList> 

CSS

.rdl label 
{ 
    display:inline-block; 
    vertical-align:top; 
} 

如果您删除vertical-align:top;,单选按钮,将在底部对齐。

我希望这样的解决方案能为你工作。

相关问题