How to determine when selected rows in a datagrid have changed ???

B

BBFrost

Ok, I know how to count the number of selected datagrid rows using the code
below. What has me stumped is how to determine when the selected rows
within a datagrid have been changed. The DataGrid object doesn't seem to
have a any type of a selection changed type of event I can grab.

THE QUESTION: Does anyone know how to determine when the selected row or
set of rows within a datagrid has changed ???

This is driving me nuts !

Thanks in advance!

Barry
in Oregon


private int ReturnNbrOfSelectedDataGridRows(DataGrid dgSearchResults)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext
[this.dgSearchResults.DataSource,
this.dgSearchResults.DataMember];

DataView dv = (DataView)cm.List;

int iRowCount = 0;

for(int i=0; i < dv.Count; ++i)
{
if(this.dgSearchResults.IsSelected()){ ++ iRowCount;}
}
}
 
R

Rajesh R

Hi,
The (corresponding) underlying datarow of the bound datasource will have the
RowState property. This property tells you if that particular row has been
modified

HTH.
+Rajesh R
 
B

BBFrost

Rajesh,

Thanks for the response. Its very much appreciated. Unfortunately after
re-reading the question I posed I realized that the question was not well
formed.

What I'm trying to figure out is the following ...

Rows 12 thru 24 are selected in a datagrid. How do I tell when the user
selects rows 45 thru 70 ???

Guess I'd better repost with a more properly formed question. :)

Thanks for taking the time to answer.

Best wishes,

Barry
in Oregon

Rajesh R said:
Hi,
The (corresponding) underlying datarow of the bound datasource will have the
RowState property. This property tells you if that particular row has been
modified

HTH.
+Rajesh R

BBFrost said:
Ok, I know how to count the number of selected datagrid rows using the code
below. What has me stumped is how to determine when the selected rows
within a datagrid have been changed. The DataGrid object doesn't seem to
have a any type of a selection changed type of event I can grab.

THE QUESTION: Does anyone know how to determine when the selected row or
set of rows within a datagrid has changed ???

This is driving me nuts !

Thanks in advance!

Barry
in Oregon


private int ReturnNbrOfSelectedDataGridRows(DataGrid dgSearchResults)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext
[this.dgSearchResults.DataSource,
this.dgSearchResults.DataMember];

DataView dv = (DataView)cm.List;

int iRowCount = 0;

for(int i=0; i < dv.Count; ++i)
{
if(this.dgSearchResults.IsSelected()){ ++ iRowCount;}
}
}
 
K

Kevin Yu [MSFT]

Hi Barry,

I have posted a reply on you new thread. Could you pick it up on that
thread? Thank you!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top