How to get the selected row from a grid control

I just went thru the code snippet where from u can extract the selected row from a databound grid! will the same work for Grid control and Grid control base? Plz respond back quickly! Its very urgent! We have been struck up here

2 Replies

AD Administrator Syncfusion Team November 11, 2005 01:30 PM UTC

You can try this code snippet to get the selected current row: this.gridControl1.SelectionChanged += new Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventHandler(this.gridControl1_SelectionChanged); private void gridControl1_SelectionChanged(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventArgs e) { //For GridControl Console.WriteLine("Row {0} selected in GridControl",this.gridControl1.Selections.Ranges.ActiveRange.Top); } this.gridDataBoundGrid1.Model.SelectionChanged+=new GridSelectionChangedEventHandler(Model_SelectionChanged); private void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e) { //For GridDataBoundGrid Console.WriteLine("Row {0} selected in GridDataBoundGrid",this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Top); } Let us know if this helps. Best Regards, Jeba.


AD Administrator Syncfusion Team November 11, 2005 01:32 PM UTC

You can try this code snippet to get the selected current row: this.gridControl1.SelectionChanged += new Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventHandler(this.gridControl1_SelectionChanged); private void gridControl1_SelectionChanged(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangedEventArgs e) { //For GridControl Console.WriteLine("Row {0} selected in GridControl",this.gridControl1.Selections.Ranges.ActiveRange.Top); } this.gridDataBoundGrid1.Model.SelectionChanged+=new GridSelectionChangedEventHandler(Model_SelectionChanged); private void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e) { //For GridDataBoundGrid Console.WriteLine("Row {0} selected in GridDataBoundGrid",this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Top); } Let us know if this helps. Best Regards, Jeba.

Loader.
Up arrow icon