I need particular columns from datatable to bind it in DataGridView. I have following column.
Work1 Price Area que Len bre size
A 12 x 1 1.2 1 1.2
A 12 y 2 2 2.2 4.4
A 12 z 3 11 1 11
Above is my data table and I need specifyed column i.e Area, Que, bre, size [Que * (bre * Len)]
To get this type of data I had used following Linq-to-DataTable query.
var data = dt.AsEnumerable().Select
(r => new
{
Area = r.Field<string>("Area"),
Que = r.Field<int>("Quantity"),
Breath = r.Field<decimal>("Breath"),
Length = r.Field<decimal>("Length"),
totLen = r.Field<int>("Quantity") * (r.Field<decimal>("Breath") * r.Field<decimal>("Length"))
}).ToList();
But its not working, It gives no value, I don't know why?? Can any one tell me how can I do this? And if there is any other alternate option is available than I love to see that...