Tuesday, November 24, 2009

query on datagrid


I want to query a datagrid on the page. possibly using Linq.

My purpose is to extract data of a column into an IList:-
currently doing like:-
for each(raddatagriditem item in radgrid.items)

but Due to performance concerns, I want to use Linq directly to populate "uniquecolumnname" string  values to another Ilist<string>.

please suggest how to query a datagrid item collection directly.

email removed


Reply 1

Hi hemantrhtk,

Do you mean get all the values of “uniquecolumnname” from DataGridView (You have said Linq, so it might be DataGridView not DataGrid, right?)?

If my understanding is correct, you can use this code to get value
foreach (DataGridViewRow dgvRow in myDataGridView1.Rows)
If I misunderstood you, please feel free to tell me.

Kira Qian

Reply 2

You can also use DataTable.Select(filterExpression) instead.

With best regards, Yasser Zamani