首页 > 其他 > 详细

DropDownList绑定多个字段

时间:2018-05-24 17:10:26      阅读:233      评论:0      收藏:0      [点我收藏+]
     string sql_ch = string.Format("select C_ID,C_name from T_Channel");
                DataTable dt_ch = DBUtility.DbHelperSQL.Query(sql_ch).Tables[0];
                if (dt_ch != null && dt_ch.Rows.Count > 0)
                {
                    for (int i = 0; i < dt_ch.Rows.Count; i++)
                    {
                        string strText = "[" + dt_ch.Rows[i]["C_ID"].ToString() + "]" + dt_ch.Rows[i]["C_name"].ToString();
                        string strValue = dt_ch.Rows[i]["C_ID"].ToString(); ;
                        ListItem listItem = new ListItem
                        {
                            Text = strText,
                            Value = strValue
                        };

                        this.DropDownList1.Items.Add(listItem);
                    }
                }

  

DropDownList绑定多个字段

原文:https://www.cnblogs.com/njy888888/p/9083737.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!