Populate a UserControl Gridview with a List of Objects

后端 未结 4 496
傲寒
傲寒 2021-01-03 10:05

I have a List of an object called \"Reasons\" that contains two properties \"Code\" & \"Text\". I want to use this to fill a UserControl of a Gridview. However, I don\

4条回答
  •  别那么骄傲
    2021-01-03 10:53

    While binding to datasource as suggested in other answers will work for a basic grid, I don't like that approach b/c it makes paging and sorting more difficult. You'll have fewer headaches in the long run if you bind an ObjectDataSource to a business tier as suggested here:

    populate gridview via code-behind or markup DataSource?

提交回复
热议问题