如何在asp.net treeview控件中设置节点文本宽度
我有一个asp.net TreeView控件,我在该控件上设置了固定的宽度,但是我的节点文本在控件的边缘上运行,即使我在节点上指定了宽度:如何在asp.net treeview控件中设置节点文本宽度,asp.net,css,visual-studio-2012,treeview,Asp.net,Css,Visual Studio 2012,Treeview,我有一个asp.net TreeView控件,我在该控件上设置了固定的宽度,但是我的节点文本在控件的边缘上运行,即使我在节点上指定了宽度: <style type="text/css"> .treeNode { color:red; font: 14px Arial, Sans-Serif; width:30px; } .rootNode { font-size: 18px; c
<style type="text/css">
.treeNode {
color:red;
font: 14px Arial, Sans-Serif;
width:30px;
}
.rootNode {
font-size: 18px;
color:blue;
width:30px;
}
.leafNode {
padding: 4px;
color:orange;
width:30px;
}
.selectNode {
font-weight: bold;
color:purple;
}
</style>
<asp:TreeView ID="tvData" runat="server" ShowLines="True" Width="100" BorderStyle="Solid">
<LeafNodeStyle CssClass="leafNode" />
<NodeStyle CssClass="treeNode" />
<RootNodeStyle CssClass="rootNode" />
<SelectedNodeStyle CssClass="selectNode" />
<Nodes>
<asp:TreeNode Text="Root" Value="0">
<asp:TreeNode Text="Products Products Products">
<asp:TreeNode Text="First Product" />
<asp:TreeNode Text="Second Product Second Product Second Product" />
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
特雷诺德先生{
颜色:红色;
字体:14px Arial,无衬线;
宽度:30px;
}
.rootNode{
字号:18px;
颜色:蓝色;
宽度:30px;
}
.叶节点{
填充:4px;
颜色:橙色;
宽度:30px;
}
.选择节点{
字体大小:粗体;
颜色:紫色;
}
我想停止在控件边界之外运行的文本,但不想将其换行。查看“mainTv”css
<style type="text/css">
.treeNode
{
color: red;
font: 14px Arial, Sans-Serif;
width: 30px;
}
.rootNode
{
font-size: 18px;
color: blue;
width: 30px;
}
.leafNode
{
padding: 4px;
color: orange;
width: 30px;
}
.selectNode
{
font-weight: bold;
color: purple;
}
.mainTv
{
display: table;
}
</style>
<asp:TreeView ID="tvData" runat="server" CssClass="mainTv" ShowLines="True" Width="100px"
BorderStyle="Solid">
<LeafNodeStyle CssClass="leafNode" />
<NodeStyle CssClass="treeNode" />
<RootNodeStyle CssClass="rootNode" />
<SelectedNodeStyle CssClass="selectNode" />
<Nodes>
<asp:TreeNode Text="Root" Value="0">
<asp:TreeNode Text="Products Products Products">
<asp:TreeNode Text="First Product" />
<asp:TreeNode Text="Second Product Second Product Second Product" />
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
.mainTv
{
overflow:hidden;
}