如何在运行时从树形视图中清除更改所选节点的值 [英] how to clear change selected node value from tree view at runtime

查看:70
本文介绍了如何在运行时从树形视图中清除更改所选节点的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用treeview列出了分支.使用会话,这些值将移动到所有其他.aspx页.当用户返回到树状视图页面时,用户将选择其他分支,同时现有会话值应与当前选定的节点值一起更改.

I used treeview to list out the branches. Using session the values are moving to all other .aspx pages. when user coming back to treeview pages, user will select other branch, at the same time existing session value should change with current selected node value.

推荐答案

尝试以下操作:
ASPX:
Try this:
ASPX:
<asp:treeview id="TreeView1" runat="server" onselectednodechanged="TreeView1_SelectedNodeChanged" showlines="True" xmlns:asp="#unknown">
    <nodes>
        <asp:treenode text="Root" value="Root">
            <asp:treenode text="RootSub1" value="RootSub1"></asp:treenode>
            <asp:treenode text="RootSub2" value="RootSub2"></asp:treenode>
        </asp:treenode>
        <asp:treenode text="Root2" value="Root2">
            <asp:treenode text="Root2Sub1" value="Root2Sub1">
                <asp:treenode text="Root2Sub1Sub1" value="Root2Sub1Sub1"></asp:treenode>
            </asp:treenode>
            <asp:treenode text="Root2Sub2" value="Root2Sub2"></asp:treenode>
        </asp:treenode>
    </nodes>
</asp:treeview>



CS:



CS:

protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
    Session["YourSession"] = TreeView1.SelectedNode.Value.ToString();
    //Your other code goes here.
}



检查 TreeView.SelectedNodeChanged事件 [ ^ ]更多信息.

--Amit



Check TreeView.SelectedNodeChanged Event[^] for more information.

--Amit


这篇关于如何在运行时从树形视图中清除更改所选节点的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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