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\
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:
///
/// The test class for our example.
///
class TestObject
{
public string Code { get; set; }
public string Text { get; set; }
}
void PopulateGrid()
{
TestObject test1 = new TestObject()
{
Code = "code 1",
Text = "text 1"
};
TestObject test2 = new TestObject()
{
Code = "code 2",
Text = "text 2"
};
List list = new List();
list.Add(test1);
list.Add(test2);
dataGridView1.DataSource = list;
}