Hi
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)
{
lst.add(item["uniquecolumnname"].text);
}
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.
Cheers-Hemant
+919555798309
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)
{
lst.Add(dgvRow.Cells["uniquecolumnname"].Value);
}
If I misunderstood you, please feel free to tell me.
Sincerely,
Kira Qian
Reply 2
Hi,
You can also use DataTable.Select(filterExpression) instead.
With best regards, Yasser Zamani