读出数据库里面的数据,来 绑定列表框 DropDownList1

            string ss_sql = "select isnull(genre_id,0) genre_id from ddw_member_info where member_id='"+this.Page.Session["member_id"].ToString()+"'";
            
string default_selected  = ddw.fn_execlquerysql(ss_sql); 
            
// 1 
            this.DropDownList1.DataSource         =ddw.dataset.Tables[0].DefaultView;
            
this.DropDownList1.DataTextField      = "genre_desc";
            
this.DropDownList1.DataValueField     = "genre_id";
            
this.DropDownList1.DataBind();
            
this.DropDownList1.Items.Add(new ListItem("请选择","0"));
            
this.DropDownList1.Items.FindByValue(default_selected).Selected = true;        //绑定
posted @ 2006-10-26 17:14  小K  阅读(333)  评论(1编辑  收藏  举报