/// <summary> /// 树的数据绑定,1张表,上级-1; /// </summary> /// <param name="TView"></param> /// <param name="node"></param> /// <param name="id"></param> /// <param name="DataTable"></param> /// <param name="ParentGuid"></param> /// <param name="MenuGuid"></param> /// <param name="MenuName"></param> /// <param name="ConnetionString"></param> public void AddNodes(TreeView TView, TreeNode node, string PidValue, string DataTable, string ParentGuid, string MenuGuid, string MenuName, string StrCondition, string OrderField, string SessionID) { try { sql = ControlDataBindSql.AddNodesSql(DataTable, ParentGuid, PidValue, StrCondition, OrderField); DataSet ds = db.GetDataSet(sql); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) //循环子节点集合 { TreeNode nd = new TreeNode(); nd.Value = dr[MenuGuid].ToString(); //存放节点 ID nd.Text = dr[MenuName].ToString(); //设置节点名称// if (node == null || PidValue == "-1") { TView.Nodes.Add(nd); //添加至根节点 } else { node.ChildNodes.Add(nd); //添加子节点 } AddNodes(TView, nd, nd.Value, DataTable, ParentGuid, MenuGuid, MenuName, StrCondition, OrderField, SessionID); //递归,添加该节点的子节点 } } catch (Exception Err) { ErrorLog.LogInsert(Err.Message, "ControlDataBind", SessionID); } }
public void Search(string Title, string Writer, string Id, DataGrid DGrid, Button btnFirst, Button btnPrevious, Button btnNext, Button btnLast, Label Messge, string Str, Label totalPage, string SessionID) { try { sql = KnowledgeArticleSql.SearchAticleSql(Title, Writer, Id); _Sds = db.GetDataSet(sql); DGrid.CurrentPageIndex = 0; DGrid.SelectedIndex = -1; ControlDataBind.DataGridDSBind(DGrid, _Sds, btnFirst, btnPrevious, btnNext, btnLast, Messge, Str, totalPage, SessionID); } catch (Exception Err) { ErrorLog.LogInsert(Err.Message, "CS/KnowledgeBase/KnowledgeRule", SessionID); return; } }
public void Search(string SearchType, string SearchContent, DataGrid DGrid, Button btnFirst, Button btnPrevious, Button btnNext, Button btnLast, Label message, string Str, Label totalPage, string SessionID) { try { sql = KnowledgeSql.SearchInfoSql(SearchType, SearchContent); _Sds = db.GetDataSet(sql); DGrid.CurrentPageIndex = 0; DGrid.SelectedIndex = -1; ControlDataBind.DataGridDSBind(DGrid, _Sds, btnFirst, btnPrevious, btnNext, btnLast, message, Str, totalPage, SessionID); } catch (Exception Err) { ErrorLog.LogInsert(Err.Message, "UI/Sys/Sysrepwd_Button1_Click", SessionID); return; } }