protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["SysCatID"])) { Common.MessageBox.Show(this, "缺少参数", Common.MessageBox.InfoType.warning, "history.back"); return; } int sid = 0; if (!int.TryParse(Request.QueryString["SysCatID"], out sid)) { Common.MessageBox.Show(this, "参数无效", Common.MessageBox.InfoType.warning, "history.back"); return; } Button1.Click += new EventHandler(Button1_Click); if (IsPostBack) { return; } DropDownList1.DataSource = Enum.GetNames(typeof(DS_Property_Br.ControlType)); DropDownList1.DataBind(); var bl = new DS_Property_Br(); var list = bl.Query <byte>("select mapid from DS_Property where SysCatID=" + Request.QueryString["SysCatID"]); byte[] mapid = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 }; DropDownList2.DataSource = mapid.Where(a => !list.Contains(a)); DropDownList2.DataBind(); }
private void BindDate(string sql, params object[] param) { ViewState["sql"] = sql; int pageCount = 0; var bl = new DS_Property_Br(); var list = bl.Query(sql,"px", (ToolBar1.AspNetPager.CurrentPageIndex - 1) * ToolBar1.AspNetPager.PageSize, ToolBar1.AspNetPager.PageSize, ref pageCount, param); ToolBar1.AspNetPager.RecordCount = pageCount; Repeater1.DataSource =list; Repeater1.DataBind(); }
private void BindDate(string sql, params object[] param) { ViewState["sql"] = sql; int pageCount = 0; var bl = new DS_Property_Br(); var list = bl.Query(sql, "px", (ToolBar1.AspNetPager.CurrentPageIndex - 1) * ToolBar1.AspNetPager.PageSize, ToolBar1.AspNetPager.PageSize, ref pageCount, param); ToolBar1.AspNetPager.RecordCount = pageCount; Repeater1.DataSource = list; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Product != null) { var bl = new DS_Property_Br(); var list = bl.Query("SysCatID=@0", "px", Product.SysCatID); Type t = Product.GetType(); int PryCount = 0; foreach (var item in list) { object obj =t.GetProperty("Property" + item.MapID).GetValue(Product,null); if (obj != null&&!string.IsNullOrEmpty(obj.ToString().Trim())) { AddItem(item.ProName,obj.ToString()+item.Unit);//添加一项属性 PryCount++; } } if(PryCount%2>0)//如果有效属性个数为单数,则最后要多添加一个空属性 AddItem("",""); } }
protected void Page_Load(object sender, EventArgs e) { if (Product != null) { var bl = new DS_Property_Br(); var list = bl.Query("SysCatID=@0", "px", Product.SysCatID); Type t = Product.GetType(); int PryCount = 0; foreach (var item in list) { object obj = t.GetProperty("Property" + item.MapID).GetValue(Product, null); if (obj != null && !string.IsNullOrEmpty(obj.ToString().Trim())) { AddItem(item.ProName, obj.ToString() + item.Unit);//添加一项属性 PryCount++; } } if (PryCount % 2 > 0)//如果有效属性个数为单数,则最后要多添加一个空属性 { AddItem("", ""); } } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["SysCatID"])) { Common.MessageBox.Show(this, "缺少参数", Common.MessageBox.InfoType.warning, "history.back"); return; } int sid = 0; if (!int.TryParse(Request.QueryString["SysCatID"], out sid)) { Common.MessageBox.Show(this, "参数无效", Common.MessageBox.InfoType.warning, "history.back"); return; } Button1.Click+=new EventHandler(Button1_Click); if (IsPostBack) return; DropDownList1.DataSource = Enum.GetNames(typeof(DS_Property_Br.ControlType)); DropDownList1.DataBind(); var bl = new DS_Property_Br(); var list = bl.Query<byte>("select mapid from DS_Property where SysCatID=" + Request.QueryString["SysCatID"]); byte[] mapid={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}; DropDownList2.DataSource = mapid.Where(a => !list.Contains(a)); DropDownList2.DataBind(); }