We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Row Selection

1. I need to know how to test rows are selected or not for GridDataBoundGrid. I checked the answers for similar posts, but still not quite understand. Please give some details. 2. How to bind data to a single cell of the GridControl? Thank you very much for help. Jerry Sun

3 Replies

AD Administrator Syncfusion Team September 29, 2005 07:06 AM UTC

Hi Jerry, 1.Please try this code snippet: private void gridControl1_SelectionChanged(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventArgs e) { for ( int i = 1 ; i <= this.gridControl1.RowCount ; ++i ) { bool check=this.gridControl1.Selections.GetSelectedRows(true, false).Contains(GridRangeInfo.Row(i)); if (check) { Console.WriteLine("Row "+i+" is Selected"+" This is "+check); } } 2.Please refer this Forum thread, Binding a cell Let us know if this helps. Best Regards, Jeba.


JS jsun@doble.com October 4, 2005 03:00 PM UTC

Hi Jeba, Thank you very much for your help. I tried the code and it did not work. RowCount is a property for the GridCountrol, not for the GridDataBoundGrid. I tried the loop with Rows.Count of the DataTable bounded to the grid, the boolean variable was always false no mater the row was selected or not. The code does not have compile errors. But where should I declare GridRangeInfo? Thank you again for you help. Jerry >Hi Jerry, > >1.Please try this code snippet: > >private void gridControl1_SelectionChanged(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventArgs e) > >{ > >for ( int i = 1 ; i <= this.gridControl1.RowCount ; ++i ) > >{ > >bool check=this.gridControl1.Selections.GetSelectedRows(true, false).Contains(GridRangeInfo.Row(i)); > >if (check) > >{ > >Console.WriteLine("Row "+i+" is Selected"+" This is "+check); > >} > >} > > > >2.Please refer this Forum thread, >Binding a cell >Let us know if this helps. > >Best Regards, >Jeba. >


AD Administrator Syncfusion Team October 4, 2005 03:24 PM UTC

In the code above, GridrangeInfo is being used as a static (Shared in VB) member. You just use it as shown as long as you have a using Syncfusion.Widnows.Forms.Grid statement (or an Imports statement in VB). Here is another sample that sowrk with a GridDataBoundGrid. http://www.syncfusion.com/Support/user/uploads/GDBG_6302f039.zip

Loader.
Live Chat Icon For mobile
Up arrow icon