如何基于多级Treeview中的复选框的选择在c#asp.net中绑定gridview [英] how to bind gridview in c# asp.net based on selection of check box in multilevel treeview

查看:96
本文介绍了如何基于多级Treeview中的复选框的选择在c#asp.net中绑定gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在基于xml绑定树视图控件(它包含多级.带有复选框的树视图.现在我需要根据Treview节点(父节点,子节点)的选择来绑定Gridview控件.关于以下问题.

1.如何根据选择的Treeview绑定Gridview
2.如何获取Treview节点的值和节点的路径.

谢谢
Mahesh.

Hi,
I am binding the treeview control based on the xml (it contains multilevel. Treeview with check boxes. Now i need to bind the Gridview control based on the selection of Treview nodes(parent, child nodes). I request can you any body help me on the below issues.

1. How to bind the Gridview based on selection of Treeview
2. How to get the Treview node values and path of the nodes.

Thanks
Mahesh.

推荐答案

TreeView 控件添加TreeNodeCheckChanged Event Handler,在PostBack 上,您将获得选定的节点值和完整路径,如下所示:

Add a TreeNodeCheckChanged Event Handler to TreeView control and on PostBack you will get the selected node value and full path as follows:

protected void TreeView1_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
{
        string nodePath = e.Node.ValuePath;
        string nodeValue = e.Node.Value;
}



基于nodeValue 选择(或nodePath 选择),您从数据库中检索数据并填充在GridView中.

您可以在此处看到许多TreeView的示例: http://quickstarts.asp.net /QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx [ ^ ]



Based on the nodeValue selection (Or, nodePath selection) you retrieve data from the database and populate in the GridView.

You can see a number of examples of TreeView here : http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx[^]


尝试以下链接:
链接1 [
Try the link below:
Link-1[^]


这篇关于如何基于多级Treeview中的复选框的选择在c#asp.net中绑定gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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