Beispiel #1
0
        /// <summary>
        /// 绑定NewsCode
        /// </summary>
        /// <param name="facid"></param>
        private void ddlSpeadBind()
        {
            DataSet dst = db.GetNewsCode();

            DataTable dtNew = dst.Tables[0].Clone();
            DataRow   drNew = dtNew.Rows.Add();

            drNew["category"]     = "";
            drNew["categoryname"] = "请选择";

            foreach (DataRow dr in dst.Tables[0].Rows)
            {
                drNew           = dtNew.Rows.Add();
                drNew.ItemArray = dr.ItemArray;
            }

            this.ddlSpead.DataSource     = dtNew.DefaultView;
            this.ddlSpead.DataTextField  = "categoryname";
            this.ddlSpead.DataValueField = "category";
            this.ddlSpead.DataBind();
        }