Adding dynamic columns to an ASP.NET Gridview

前端 未结 9 1396
不思量自难忘°
不思量自难忘° 2020-12-28 18:54

I\'m having a problem dynamically adding columns to a GridView. I need to change the layout -- i.e. the included columns -- based on the value in a DropDownList. When the

9条回答
  •  臣服心动
    2020-12-28 19:03

    I found this earlier today: TemplateField in a GridView doesn't have its ViewState restored when BoundFields are inserted.

    Looks like a bug that Microsoft doesn't plan on fixing, so you'll have to try one of the solutions above. I'm having the same problem -- I have some DataBoundFields and some TemplateFields, and after a postback, the TemplateField based columns lose their controls and data.

提交回复
热议问题