Asp.net 为什么文本移动到复选框下而不是复选框旁边的一行?
在VB代码中,在我创建Div以便在if语句期间将文本更改为红色之前,文本与复选框对齐。现在,当我添加颜色更改代码时,Asp.net 为什么文本移动到复选框下而不是复选框旁边的一行?,asp.net,css,vb.net,Asp.net,Css,Vb.net,在VB代码中,在我创建Div以便在if语句期间将文本更改为红色之前,文本与复选框对齐。现在,当我添加颜色更改代码时,child.Text=”“+child.Text&,它会将文本移动到复选框下,而不是复选框旁边。我试过Span,但它不起作用。我希望文本位于复选框旁边 child.Text = "<font color='red'>" + child.Text + "</font>" 下面是详细的VB代码 'populate the child nodes
child.Text=”“+child.Text&
,它会将文本移动到复选框下,而不是复选框旁边。我试过Span,但它不起作用。我希望文本位于复选框旁边
child.Text = "<font color='red'>" + child.Text + "</font>"
下面是详细的VB代码
'populate the child nodes
While dr.Read()
Dim child As TreeNode = New TreeNode(dr("Name"), dr("Name"))
Dim complianceFlag As Boolean
If Boolean.TryParse(dr("Compliance"), complianceFlag) Then
' Yes, compliance value is a Boolean, now set color based on value
If Not complianceFlag Then
child.Text = "<div style='color:Red; display: inline; float: left;'>" + child.Text & "</div>"
End If
Else
End If
rootNode.ChildNodes.Add(child)
child.SelectAction = TreeNodeSelectAction.None
End While
”填充子节点
而里德博士
Dim child As TreeNode=新的TreeNode(dr(“Name”)、dr(“Name”))
Dim complianceFlag作为布尔值
如果是Boolean.TryParse(dr(“Compliance”),complianceFlag),那么
'是,符合性值是布尔值,现在根据值设置颜色
如果不符合法规,则
child.Text=”“+child.Text&“”
如果结束
其他的
如果结束
rootNode.ChildNodes.Add(子节点)
child.SelectAction=treeNodeAction.None
结束时
HTML代码
<div>
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<ContentTemplate>
<asp:TreeView onclick="client_OnTreeNodeChecked();" ID="TreeViewGroups" runat="server"
ShowCheckBoxes="All" ExpandDepth="0" CssClass="bold">
</asp:TreeView>
<asp:Label ID="LabelNoServers" runat="server" Text=""></asp:Label>
</ContentTemplate>
<Triggers>
<%--<asp:AsyncPostBackTrigger ControlID="b_DelYes" EventName="Click" />--%>
</Triggers>
</asp:UpdatePanel>
</div>
我找到了一个解决方案,而不是使用
,而是使用
。这样,它将删除空间并移回下一行复选框
child.Text = "<font color='red'>" + child.Text + "</font>"
child.Text=”“+child.Text+“”
请发布页面中生成的HTML输出。听起来你有一个不理解的浮动问题。我通过添加HTML代码编辑了它。我不明白为什么我被否决了。这是唯一可行的简单解决方案。Div、Span、p和其他标记不起作用。它很可能被否决,因为该问题的措辞混乱,您也没有显示生成的HTML,您只显示了.aspx页面-这不是呈现的HTML。