如何使ASP CheckBoxList标签与复选框保持在同一行

Pur*_*ish 6 css vb.net asp.net checkboxlist

这可能是一个常见的问题,但我很难找到解决方案来解决它

我有一个模式弹出窗口我用jQuery显示,这个弹出窗口包含一个Checkboxes和一个Button的列表,代码如下所示:

<div id="dialog" title="Notify Users" >
    <div style="width:100%; height:500px; overflow:auto;">
        <asp:CheckBoxList ID="chkNotify" 
            runat="server" 
            CssClass="checkboxlist_nowrap"
            RepeatLayout="Table" 
            /> 
    </div>
    <asp:Button ID="btnSaveNotifications"
        runat="server" 
        Text="Ok"
        />
</div>
Run Code Online (Sandbox Code Playgroud)

弹出窗口正确显示,但每个复选框的标签位于复选框下方的行上.我似乎无法弄清楚为什么会发生这种情况,起初我认为div包含它的CheckBoxList只是太小所以我给每个都有div一个固定的宽度,但这没有任何帮助.

我也试过应用这个CSS

.checkboxlist_nowrap tr td label
{
    white-space:nowrap;
    overflow:hidden;
    width:100%;
}
Run Code Online (Sandbox Code Playgroud)

它没有帮助,但我不确定样式表是否实际使用,即使我有:

  <link href="../css/HelpDesk.css" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)

在我的头标签.

任何人都可以提出我可以尝试的其他建议

谢谢

更新:这是我的Jquery:

 $(function () {
    $("#dialog").dialog({
       autoOpen: false,
       show: "blind",
       width: 400, 

       hide: "explode"
    });
Run Code Online (Sandbox Code Playgroud)

这是我如何填充CheckBoxList:

 Private Sub populateCheckBoxList()

      Dim notificationList As DataTable
      notificationList = dbGetNotificationsList(1)

      For Each dr As DataRow In notificationList.Rows

         Dim li As New ListItem
         li.Text = dr("FullName")
         li.Value = dr("ID")

         If (dr("Checked") = 1) Then
            li.Selected = True
         Else
            li.Selected = False
         End If
         chkNotify.Items.Add(li)

      Next

   End Sub
Run Code Online (Sandbox Code Playgroud)

我已经尝试将CheckBoxList移动​​到form标签内部,这样就不会应用任何其他样式,也不会影响它,但是我仍然遇到同样的问题.

小智 11

对我来说,上述解决方案都没有工作,所以我查找了确切的HTML渲染,发现标签的display属性设置为block.将其更改为内联工作:

.checkboxlist_nowrap label
{
     display:inline;
}
Run Code Online (Sandbox Code Playgroud)


Pur*_*ish -1

将其标记为已关闭,因为我从未设法弄清楚,并且该问题已传递给另一个开发人员。当我回来时会将答案发布在这里。

我真的很感谢人们不要因为将其标记为关闭而投票给我,我不再在公司工作了,我绝对没有办法重新创建问题或验证人们发布的任何解决方案,并且在我将其设置为关闭时提供的解决方案都没有解决该问题。