1 DataTable dt_attrname = new DataTable(); 2 DataTable dt_valuename = new DataTable(); 3 dt_valuename = goodsmanagebll.Get_AdminGetAttributeListandValues(_cateid).Tables[0]; //属性值 4 dt_attrname = goodsmanagebll.Get_AdminGetAttributeListandValues(_cateid).Tables[1]; //属性名称 5 6 if(dt_attrname.Rows.Count>0) 7 { 8 for (int i = 0; i < dt_attrname.Rows.Count; i++) 9 // for (int i = 0; i < 1; i++) 10 { 11 ASPxLabel lb = new ASPxLabel(); 12 lb.Text = dt_attrname.Rows[i]["ATTRNAME"].ToString(); 13 14 ASPxPanel1.Controls.Add(lb); 15 //li.Controls.Add(lb); 16 17 DataRow[] dr = dt_valuename.Select(" attrid = " + dt_attrname.Rows[i]["attrid"].ToString()); 18 19 ASPxCheckBoxList aspxcheckboxlist = new ASPxCheckBoxList(); 20 aspxcheckboxlist.Border.BorderStyle = 0; 21 22 aspxcheckboxlist.RepeatDirection = RepeatDirection.Horizontal; 23 24 foreach (DataRow dr1 in dr) 25 { 26 ListEditItem lei = new ListEditItem(); 27 28 lei.Text = dr1["ATTRVALUE"].ToString(); 29 lei.Value = dr1["ATTRVALUEID"].ToString(); 30 31 aspxcheckboxlist.ID = "ck" + i; 32 aspxcheckboxlist.Items.Add(lei); 33 34 } 35 36 // li.Controls.Add(aspxcheckboxlist); 37 ASPxPanel1.Controls.Add(aspxcheckboxlist); 38 39 // ASPxCheckBoxList ckboxlist = this.ASPxPanel1.FindControl("ck0") as ASPxCheckBoxList; 40 } 41 } 42