zoukankan      html  css  js  c++  java
  • 如何在后台动态生成ASPxCheckBoxList标签并循环(数据调用存储过程)

     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           
    View Code
  • 相关阅读:
    ajax传json
    JSON 转 VO
    字符串转数组
    "No 'Access-Control-Allow-Origin' header"跨域问题CROS
    jdbc连接SQLServer
    Jquery判断checkbox选中状态
    JSON与null
    点击劫持
    Eclipse 入手配置
    SQL练习(一)
  • 原文地址:https://www.cnblogs.com/dfxyw/p/5080180.html
Copyright © 2011-2022 走看看