DropDownList绑定多个字段

     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);
                    }
                }

  

猜你喜欢

转载自www.cnblogs.com/njy888888/p/9083737.html