all groups > dotnet compact framework > november 2005 >
You're in the

dotnet compact framework

group:

DataGrid and MultiSelect


DataGrid and MultiSelect Nathan
11/5/2005 11:27:44 AM
dotnet compact framework:
Apparently the DataGrid only supports single select in CF 1.0. Although you
can highlight multiple rows, only one has the triangle and is returned as
the row selected.

Is there any way to fake it? I'd like to get a list of primary keys for rows
that are highlighted and perform some operations.

I figure this is something that someone has done before, so any examples are
helpful.

Nathan

Re: DataGrid and MultiSelect Sergey Bogdanov
11/7/2005 9:37:44 AM
You may try the following code:

int top = dataGrid1.CurrentRowIndex;
while(top - 1 > -1 && dataGrid1.IsSelected(top - 1)) top--;

int bottom = dataGrid1.CurrentRowIndex;
int numberOfRecords = 100;
while(bottom + 1 < numberOfRecords && dataGrid1.IsSelected(bottom + 1))
bottom++;

MessageBox.Show("Indices range of selected rows: " + top.ToString() + "
- " + bottom.ToString());



--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


[quoted text, click to view]
AddThis Social Bookmark Button