i have a linq result as var & query as following
var groups = myDataTable.AsEnumerable()
.GroupBy(r => r.Field<string>("X"))
.Select(g => new { Name = g.Key,Count=g.Count() });
I want to bind the result to datagridview.
Please suggest
Thanks
Try the following:
dataGridView.DataSource = groups.ToList();
updated
Have you tried this way?
yourGridView.DataSource=groups.ToList();
yourGridView.DataBind();
for WinForm apps only do this:
yourGridView.DataSource=groups.ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With