How do I bind a GridView to a custom object?

后端 未结 3 2054
耶瑟儿~
耶瑟儿~ 2020-12-10 15:50

If I have the following ASP.NET code (it\'s not complete - obviously there\'s a lot missing, but none of it matters):

    
        

        
3条回答
  •  时光说笑
    2020-12-10 15:53

    First remember any binding controls like GridView, DropdownList e.t.c bind to public properties, so first make your public members to public properties.

    Then create objects of MyObject class and add them to your List object

    Finally you can persist this list object by saving it in Session or ViewState to maintain it after postbacks.

    I hope you can do it now!!! you can ask for more help if neccessary.

提交回复
热议问题