Reputation: 10815
How to arrange column in my data grid view for windows application when I am binding it with a list type object?
In db I have 2 many queries to fetch the data so that I can not change I need to make it at form level please suggest.
Following is a small code for this
public void FillGrid(string DriverID)
{
grdOrderByDriver.DataSource = cOrder.GetOrderDetailByDriver(int.Parse(DriverID));
double sum = 0.0;
SetGird();
sum = CalculateOrderTotal(sum);
}
GetOrderDetailByDriver
returns object of
BindingList<cOrder> lstOrderByDriver = new BindingList<cOrder>();
Upvotes: 0
Views: 1242
Reputation: 2566
What do you mean by "arrange"?
If your intention is to change the column order, you have two possibilities:
If by "arrange" you mean sorting, then you need to implement a SortableBindingList (since the BindingList does not support sorting) like this: http://www.codeproject.com/Articles/31418/Implementing-a-Sortable-BindingList-Very-Very-Quic
Upvotes: 1