新手跪求treeView控件链接SQL数据库树形源码!!3Q
新手跪求treeView控件链接SQL数据库树形源码!!3Q517300050 发表于 2015-5-18 02:44
没有急时回复抱歉,请问你详细点吗?,
举个栗子
private void BindProductNode()
{
TreeNode root = new TreeNode("Product Phone", "Product Phone", "", "#", "");
root.Expanded = true;
tvAcc.Nodes.Add(root);
DataTable dtPlat = new DataTable();
dtPlat = reportBLL.GetPlatformList();// Data Source from db
DataTable dtPhone = new DataTable();//sub's title data source
for (int i = 0; i < dtPlat.Rows.Count; i++)
{
string platName = dtPlat.Rows["Platform"].ToString();
string accID = dtPlat.Rows["Platform"].ToString();
TreeNode tree1 = new TreeNode(platName, accID, "", "", "");
tree1.Expanded = false;
root.ChildNodes.Add(tree1);
dtPhone = reportBLL.GetPhoneList(platName);//eg."eDream6", get sub title's data source.
for (int j = 0; j < dtPhone.Rows.Count; j++)
{
string phone = dtPhone.Rows["Product"].ToString();
TreeNode treeOverview = new TreeNode(phone, accID, "", "#.aspx?platform=" + platName + "&product=" + phone, "_blank");
tree1.ChildNodes.Add(treeOverview);
}
}
}
treeview有datasource属性 直接绑定数据就行了 ibcadmin 发表于 2015-5-16 17:42
treeview有datasource属性 直接绑定数据就行了
没有急时回复抱歉,请问你详细点吗?:$, ibcadmin 发表于 2015-5-19 09:01
举个栗子
private void BindProductNode()
{
:)谢谢你,
页:
[1]