public void MyBind() { DataTable sysdt = new DataTable(); DataTable extdt = bbf.Select_Type(SType); string str = ""; switch (SType) { case 0: sysdt = labelBll.GetTableField("ZL_Orderinfo"); for (int i = 0; i < extdt.Rows.Count; i++) { if (extdt.Rows[i]["FieldName"] != null) { str += "'" + extdt.Rows[i]["FieldName"].ToString() + "',"; } } str = str.TrimEnd(','); if (sysdt != null && !string.IsNullOrEmpty(str)) //系统字段RPT { sysdt.DefaultView.RowFilter = " FieldName Not IN(" + str + ")"; sysdt = sysdt.DefaultView.ToTable(); } break; case 1: sysdt = labelBll.GetTableField("ZL_Cart"); for (int i = 0; i < extdt.Rows.Count; i++) { if (extdt.Rows[i]["FieldName"] != null) { str += "'" + extdt.Rows[i]["FieldName"].ToString() + "',"; } } str = str.TrimEnd(','); if (sysdt != null && !string.IsNullOrEmpty(str)) //系统字段RPT { sysdt.DefaultView.RowFilter = " FieldName Not IN(" + str + ")"; sysdt = sysdt.DefaultView.ToTable(); } break; } this.RepSystemModel.DataSource = sysdt; this.RepSystemModel.DataBind(); this.RepModelField.DataSource = extdt; this.RepModelField.DataBind(); string add = "<a href='AddOrderModel.aspx?Type=" + SType + "' style='color: Red'>[添加字段]</a>"; Call.SetBreadCrumb(Master, "<a href='ProductManage.aspx'>商城管理</a></li><li><a href='OrderList.aspx'>订单管理</a></li><li class='active'>字段管理<a id='ShowLink' href='javascript:ShowList()'>[显示所有字段]</a>" + add + "</li>"); }
public void MyBind() { DataTable dt = bll.GetTableField("ZL_UserBase", SqlHelper.ConnectionString); DataTable dtubf = bbf.Select_All(); dtubf.DefaultView.Sort = " OrderId asc"; StringBuilder sb = new StringBuilder(); if (dtubf.Rows.Count > 0) { for (int i = 0; i < dtubf.Rows.Count; i++) { if (dtubf.Rows[i]["FieldName"] != null) { sb.Append("'" + dtubf.Rows[i]["FieldName"].ToString() + "',"); } } } string str = sb.ToString(); if (str.EndsWith(",")) { str = str.Substring(0, str.Length - 1); } if (str.Length > 0) { DataRow[] drs = dt.Select(" fieldname not in (" + str + ")"); DataTable dts = dt.Clone(); for (int i = 0; i < drs.Length; i++) { dts.ImportRow((DataRow)drs[i]); } this.RepSystemModel.DataSource = dts; this.RepSystemModel.DataBind(); } else { this.RepSystemModel.DataSource = dt; this.RepSystemModel.DataBind(); } this.RepModelField.DataSource = dtubf; this.RepModelField.DataBind(); if (dt != null) { dt.Dispose(); } }