472,143 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

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

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;}
}
}
Nov 16 '05 #1
3 4314
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" <barry.b.frost@remove_this.wrd.state.or.us> wrote in message
news:#m*************@TK2MSFTNGP11.phx.gbl...
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;}
}
}

Nov 16 '05 #2
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" <ra*******@nospam.trigent.com> wrote in message
news:eG**************@TK2MSFTNGP15.phx.gbl...
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" <barry.b.frost@remove_this.wrd.state.or.us> wrote in message
news:#m*************@TK2MSFTNGP11.phx.gbl...
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;}
}
}


Nov 16 '05 #3
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."

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Daniel Walzenbach | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.