树视图层次结构对齐 [英] Treeview hierarchy alignment

查看:132
本文介绍了树视图层次结构对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有一种方法可以将treeview的折叠和展开图像设置在右侧(而不是javascript).通常,它显示在树视图的左部分.

提前谢谢.

Hi,

Is there a way to set the collapse and expand image of treeview to the right side (other than javascript). Usually it gets displayed in left potion of the treeview.

Thanks in advance.

推荐答案

是的,在CodeBehind
中添加以下代码
Yes, add the following code in the CodeBehind

TreeView1.Attributes["dir"] = "rtl"; (Assuming that, TreeView1 is the Treeview object)



添加此属性后,您可能需要重新布置UI,因为树形视图将浮动到屏幕的右侧.可能是,您希望将treeview放在左移的div中.

以下是一个示例:



You might need to do some UI re-arrangement after adding this attribute, because, the treeview will float to the right part of the screen. May be, you would want to put the treeview within a div with float left.

Following is an example:

<div style="float: left">
        <asp:TreeView ID="TreeView1" ExpandDepth="1" runat="server">
            <Nodes>
                <asp:TreeNode Text="Employees">
                    <asp:TreeNode Text="Bradley" Value="ID-1234" />
                    <asp:TreeNode Text="Whitney" Value="ID-5678" />
                    <asp:TreeNode Text="Barbara" Value="ID-9101" />
                </asp:TreeNode>
            </Nodes>
        </asp:TreeView>
    </div>



希望这会有所帮助:)



Hope this helps :)


这篇关于树视图层次结构对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆