asp.net2.0中Gridview控件中如何绑定dropdownlist控件-.NET技术/ASP.NET


原先在DataGrid里的方法也还可以照样使用:
  <asp:GridView   ID= "GridView1 "   runat= "server "     .........     OnRowDataBound= "GridView1_RowDataBound ">

********************
        protected   void   GridView1_RowDataBound(object   sender,   GridViewRowEventArgs   e)
        {
                if   (e.Row.RowState   ==   DataControlRowState.Normal   ||   e.Row.RowState   ==   DataControlRowState.Alternate   )
                {
                        DropDownList   ddlst   =   (DropDownList)e.Row.FindControl( "DropDownList1 ");
                        ddlst.BackColor   =   System.Drawing.Color.LightYellow;
                        //仍然可以在绑定时找到摸版列里的控件  
                }
        }
 

你可能感兴趣的:(职场,GridView,休闲,ASP.NET2.0,dropdownlist控件)