Highlighting multiple rows in a Datagrid

Joined
Sep 27, 2005
Messages
2
Reaction score
0
Hi,

I'm using code from George Shepherd's Windows Forms FAQ (http://www.syncfusion.com/faq/winforms/search/856.asp) to select whole rows in a Datagrid , and this is working fine for when a user selects a row using the row column , bowever now i want to be able to select all the rows(and hightlight them) in the grid when a user clicks a "select all" button and vice versa when they select a "Deselect All" button.

Any ideas ?

Thanks in Advance ....
 
Joined
Sep 27, 2005
Messages
2
Reaction score
0
Hi figured it out .In case anyone else is looking to do the same thing here is the code:
Call routine from click event of button.

public void HighlightAllRows(DataGrid dg)
{
CurrencyManager cm = (CurrencyManager)this.BindingContext[dg.DataSource, dg.DataMember];
DataView dv = (DataView)cm.List;

//find the current selected row
for(int i = 0; i < dv.Count; ++i)
{
dg.Select( i);
}
}

Cheers ,
A
 

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