当前位置: 代码迷 >> ASP.NET >> 急求gridview动态生成绑定控件取值有关问题,重分相送!
  详细解决方案

急求gridview动态生成绑定控件取值有关问题,重分相送!

热度:9801   发布时间:2013-02-25 00:00:00.0
急求gridview动态生成绑定控件取值问题,重分相送!!
gridview列是动态生成,然后给了两个事件如下:
protected   void   gvInfo_RowCreated(object   sender,   GridViewRowEventArgs   e)
                {
                        if   (e.Row.RowType   ==   DataControlRowType.DataRow)
                        {
                                string   c;
                                string[]   ac;
                                for   (int   i   =   3;   i   <   e.Row.Cells.Count;   i++)
                                {
                                        c   =   e.Row.Cells[i].Text;
                                        ac   =   c.Split( ', ');
                                        DropDownList   ddl   =   new   DropDownList();
                                        ddl.ID   =   "ddlRow "   +   e.Row.RowIndex.ToString()   +   i.ToString();
                                        ddl.DataSource   =   ac;
                                        ddl.DataBind();
                                        ddl.EnableViewState   =   true;
                                        e.Row.Cells[i].Controls.Add(ddl);

                                }
                        }
                }

                protected   void   gvInfo_RowDataBound(object   sender,   GridViewRowEventArgs   e)
                {
                        if   (e.Row.RowType   ==   DataControlRowType.DataRow)
                        {
                                string   c;
                                string[]   ac;
  相关解决方案