private void AddButton() { DataBase.DBService service = new DataBase.DBService(); DataSet ds = service.GetDataBase(DataBase.EnumTables.WebMap_Config, "ID", "1=1", 50, 1); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { Button bt = new Button(); bt.Text = dr["MapTitle"].ToString(); if ((bool)dr["IsLink"]) { bt.Attributes.Add("onclick", "return OnOpenUrl('" + dr["LinkPath"].ToString() + "')"); } else { bt.Attributes.Add("onclick", "return OnOpenXML('" + dr["MapPath"].ToString() + "')"); } bt.Width = Unit.Parse("150"); bt.Height = Unit.Parse("40"); plFunction.Controls.Add(bt); } } //DataTable dt = powerService.Get_SystemInfo("IsWebMap = 'true'").Tables[0]; //foreach (DataRow dr in dt.Rows) //{ // Button bt = new Button(); // bt.Text = dr["SystemName"].ToString(); // if (bt.Text.Equals("") )//|| dr["IsWebMap"].ToString().Equals("False")) // { // bt = null; // } // if (bt != null) // { // if (dr["Map"].ToString().Contains(".xml") || dr["Map"].ToString().Equals("")) // { // bt.Attributes.Add("onclick", "return OnOpenWindowsByBtn('" + dr["Map"].ToString() + "')"); // } // else // { // bt.Attributes.Add("onclick", "return OnOpenHtmlByBtn('" + dr["Map"].ToString() + "')"); // } // bt.Width = Unit.Parse("150"); // bt.Height = Unit.Parse("40"); // plFunction.Controls.Add(bt); // } //} }
/// <summary> /// 绑定到GridView /// </summary> private void BindGridView() { DataBase.DBService dbservice = new DataBase.DBService(); DataSet ds = dbservice.GetDataBase(DataBase.EnumTables.Power_View_Account, "AccountNO", txtWhere.Value, 200,1); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { // GridView绑定并显示数据 this.gdvContact_Info.DataSource = ds.Tables[0]; this.gdvContact_Info.DataBind(); tdNoData.Visible = false; tabAddress.Visible = true; } else { tabAddress.Visible = false; tdNoData.Visible = true; } }
/// <summary> /// 绑定到GridView /// </summary> private void BindGridView() { DataBase.DBService dbservice = new DataBase.DBService(); DataSet ds = dbservice.GetDataBase(DataBase.EnumTables.Power_View_Account, "AccountNO", txtWhere.Value, 10, int.Parse(hidPageIndex.Value)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { // GridView绑定并显示数据 this.gdvContact_Info.DataSource = ds.Tables[0]; this.gdvContact_Info.DataBind(); int count = int.Parse(ds.Tables[1].Rows[0][0].ToString()); lblCount.Text = count % 10 > 0 ? (count / 10 + 1).ToString() : (count / 10).ToString(); lblIndex.Text = hidPageIndex.Value; hidCount.Value = lblCount.Text; SetLinkButton(); tdNoData.Visible = false; tabAddress.Visible = true; trAll.Visible = true; } else { tabAddress.Visible = false; trAll.Visible = false; tdNoData.Visible = true; } }