.net dropdownlist 動態顯示,指定字段

时间:2014-05-08 23:17:48   收藏:0   阅读:432

dropdownlist 動態顯示,指定字段
bubuko.com,布布扣
            this.ddlPermission.Items.Clear();
                    this.ddlPermission.Items.Insert(0,new ListItem("請選擇",""));
                    this.ddlPermission.Items.Insert(1,new ListItem("管理01",DEP_ID+"01"));
                    this.ddlPermission.Items.Insert(2,new ListItem("管理02",DEP_ID+"02"));
                    this.ddlPermission.Items.Insert(3,new ListItem("檢視03",DEP_ID+"03"));
                    this.ddlPermission.Items.Insert(4,new ListItem("檢視04",DEP_ID+"04"));
                    this.ddlPermission.Items.Insert(5,new ListItem("檢視05",DEP_ID+"05"));
                    
                    foreach(DataRow dr in dt.Rows)
                    {
                        this.ddlPermission.Items.Remove(ddlPermission.Items.FindByText(dr["PermissionName"].ToString()));

//                        foreach(ListItem li in this.ddlPermission.Items)
//                        {
//                            Response.Write(li.Text);
//                            //Response.Write("li.text="+li.Text+" <br /> dr="+dr["PermissionName"].ToString());
//                            if(dr["PermissionName"].ToString()==li.Text )
//                            {
//                                this.ddlPermission.Items.Remove(li.Text);
//                            }
//                        }
                    }
                    Response.Write("<br />"+this.ddlPermission.Items.Count);
                }
bubuko.com,布布扣

 

.net dropdownlist 動態顯示,指定字段,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!