This is a migrated thread and some comments may be shown as answers.

Get values from grid after sort/filter

0 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lars
Top achievements
Rank 1
Lars asked on 26 Mar 2018, 09:09 AM

Hi

In the NeedDataSource event i am binding a table to the grid. I need to get all values from all rows (one column) after binding. 

Today i use this simple code

grid.DataSource = _searchResult;  //DataTable
List<string> activitiesList = new List<string>();
foreach (DataRow row in _searchResult.Rows)
  activitiesList.Add(row["ActivityNumber"].ToString());

But this only gets me an unsorted list.

I have tried to get values from mastertableview:

grid.DataSource = _searchResult;  //DataTable
List<string> activitiesList = new List<string>();  
foreach (GridDataItem item in grid.MasterTableView.Items)
activitiesList.Add(item.GetDataKeyValue("ActivityNumber").ToString());

 

But since i use paging i only get the first 50.

So how can i get all values from all rows after binding a table to the grid. I need the entries in the way the grid is sorted .

 

Thank you

Lars E.

 

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Lars
Top achievements
Rank 1
Share this question
or