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’t understand how to link the gridview to the List of Reasons and actually set which data to use from the object.
I would assume the approach would be to set the datasource to the List, however, that is not working as it does seem populate the gridview with any rows. Is there a better approach to this problem?
I am assuming you’re doing this in winform C#. It should be fairly similar in C# codebehind for asp.net.
Here’s some sample code you can easily customize to your obj type: