How to bind a list in DevExpress Grid Control - Winform C#.Net

How to bind tabular data to DevExpress Grid Control in C#.Net Winform

DevExpress

DevExpress is .Net library which provides lots of cool data features, to our .Net applications. One of them was the data grid.

All we have to do is attach the data and tune the features required by our application, such as filtering, conditional formatting, searching, summary etc.

Add a Grid Control to your project

Data Source

As in the DataGridView DevExpress GridControl accepts list of object (class). The properties of class defines the column.

Here is simple class which store financial transactions.

internal class FTModel
    {
        public string ID { get; set; }
        public string ACCOUNT { get; set; }
        public Double DR { get; set;}
        public Double CR { get; set;} 
    }

Let's create a List of FTModel.

List<FTModel> list = new List<FTModel>(){
ACCOUNT="AJUNA ASSOCIATES ,DR=1200,CR=0,ID=78
};

 gridControl1.DataSource = list;

Now see the magic happens. Your data is ready for explore. Right click the grid and see the available functionality.

We can also utilize the Excel like Aggregate functions in the footer section. Right click the footer section, corresponding to each column.

Alternately we can also use datasets and tables to populate reports in DevExpress GridControl.

devexpress
grid-control
grid-view
c#.net

Write your comment