c# 后台绑定treeview 多个tab
2021-02-10 18:15
标签:tabs oid cte bin 类型 cut lap ike eva string str= "SELECT [a],[b] FROM [表名] ";
DataTable dtOil = DbHelper.DAL.ExecuteDataSet(str).Tables[0]; c# 后台绑定treeview 多个tab 标签:tabs oid cte bin 类型 cut lap ike eva 原文地址:https://www.cnblogs.com/otsf/p/8520911.html
tree1(dtOil, ""); public void tree1(DataTable dtOil, string name)
{
string role = "select u.DisplayName from (select ur.UserID from (select RoleID from roles where RoleName=‘厂家‘ ) as r left join userroles ur on r.RoleID=ur.RoleID) as us left join users u on u.UserID=us.UserID where u.DisplayName like ‘%" + name + "%‘";
DataTable dtrole = DbHelper.DAL.DataTable(role);
C1Tab1.Pages.Clear();
for (int i = 0; i //tab绑定
C1.Web.Wijmo.Controls.C1Tabs.C1TabPage ctab = new C1.Web.Wijmo.Controls.C1Tabs.C1TabPage();
ctab.ID = "C1TabPage" + i + "";
ctab.Text = dtrole.Rows[i][0].ToString();
C1TreeView c1 = new C1TreeView();
c1.ID = "tabstree" + i.ToString();
ctab.Controls.Add(c1);
C1Tab1.Pages.Add(ctab);
}
for (int i = 0; i 数据绑定
if (i == 0)
{
treeValues = "";
}
else
{
treeValues += "&";
}
C1TreeView c1 = (C1TreeView)C1Tab1.Pages[i].Controls[0];
c1.ShowCheckBoxes = true;
c1.ShowExpandCollapse = true;
string strchangjia = "SELECT * from (SELECT [a],[b] FROM [表名] where [treeType] = ‘1‘ and 品牌 like ‘%[0-9]%‘ group by [a],[b]) as jiu where jiu.alike ‘%" + dtrole.Rows[i][0].ToString().Replace(" ", "") + "%‘";
DataTable dchangjia = GJPDbHelper.DAL.DataTable(strchangjia);
BindTreeOil2(dchangjia, c1);
count++;
}
}
private C1TreeView BindTreeOil2(DataTable dtSource, C1TreeView c)
{
c.Nodes.Clear();
string topNodeStr = "";
string twoNodeStr = "";
C1TreeViewNode curNode = new C1TreeViewNode(); ;
//DataRow[] rows = dtSource.Select(string.Format("ParentID={0}", parentID));
foreach (System.Data.DataRow c1row in dtSource.Rows)
{
if (topNodeStr != Convert.ToString(c1row[0]))
{
C1TreeViewNode newNode = new C1TreeViewNode();
newNode.Value = Convert.ToString(c1row[0]);
newNode.Text = Convert.ToString(c1row[0]);
c.Nodes.Add(newNode);
topNodeStr = Convert.ToString(c1row[0]);
curNode = newNode;
}
else
{
C1TreeViewNode newNode = new C1TreeViewNode();
newNode.Value = Convert.ToString(c1row[1]);
newNode.Text = Convert.ToString(c1row[1]);
//string str = "select 产品 from [AIRB_MMTREE] where [类型] =‘" + c1row[1].ToString() + "‘";
//DataTable dt = GJPDbHelper.DAL.DataTable(str);
//for (int i = 0; i
文章标题:c# 后台绑定treeview 多个tab
文章链接:http://soscw.com/index.php/essay/53674.html