简体   繁体   English

我的asp.net(C#4.0)页面上始终以蓝色显示节点的Treeview字体颜色吗?

[英]Treeview font color of the node is shown in blue color always in my asp.net(C# 4.0) page?

I have added one TreeView control in my ASP.NET page.when i seeing the aspx file, it's forecolor is set to black color.But when i seeing in the browser then it is changed to blue color by default. 我在ASP.NET页面中添加了一个TreeView控件。当我看到aspx文件时,它的前颜色设置为黑色,但是当我在浏览器中看到时,默认情况下它更改为蓝色。

i want to display tree node forecolor in black color only... 我只想以黑色显示树节点原色...

This is my Code... 这是我的代码...

 <asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows" 
                                    ExpandDepth="0" ShowCheckBoxes="None" onselectednodechanged="TreeView1_SelectedNodeChanged" 
                                    style="margin-left: 5px" Font-Names="Verdana" ForeColor="Black" NodeWrap="True" 
                                    Height="250px" NodeStyle-CssClass="Color" Width="275px" Font-Size="X-Small" >
                                </asp:TreeView>

Please guide me to get out of this issue... 请指导我摆脱这个问题...

Try this : 尝试这个 :

<asp:TreeView ID="tree1" runat="server">
            <Nodes>
                <asp:TreeNode Text="A"></asp:TreeNode>
                <asp:TreeNode Text="B"></asp:TreeNode>
                <asp:TreeNode Text="C"></asp:TreeNode>
            </Nodes>
            <NodeStyle CssClass="Color" />
        </asp:TreeView>



<style type="text/css">
        .Color{
            color:black !important;
        }
    </style>

Thanks 谢谢

Try this 尝试这个

Whenever you add the node named childNode, you have to set the property called SelectAction as given below 每当添加名为childNode的节点时,都必须设置名为SelectAction的属性,如下所示

childNode.SelectAction = TreeNodeSelectAction.None;

By default the SelectAction will be select, because of that you will getting the hyperlink that is blue colour to your text. 默认情况下,将选择SelectAction,因为这样您将获得文本为蓝色的超链接。

If your adding those elements in static do it this way 如果您以静态方式添加这些元素,请按照以下方式进行操作

<Nodes>


 <asp:TreeNode Text="Node1" SelectAction="None"></asp:TreeNode>

</Nodes>

Hope it helps!!! 希望能帮助到你!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM