Select Row in DataBoundGrid

Hi, How can ensure that only the whole row is selected when a user clicks any cell in a databound grid? Thanks, Nick

2 Replies

AD Administrator Syncfusion Team May 18, 2006 08:37 AM UTC

Hi Nick, Try this code to select a row in a Grid. Here is a code snippet. this.gridDataBoundGrid1.ListBoxSelectionMode = SelectionMode.One Best Regards, Haneef


AD Administrator Syncfusion Team May 18, 2006 09:02 AM UTC

Hi Nick, Sorry for the inconvenience caused. To check the selection type, you need to handle the Grid.Model.Selectionchanging event. Here is a code snippet. //Form Load. this.grid.Model.SelectionChanging +=new GridSelectionChangingEventHandler(Model_SelectionChanging); GridRangeInfo info = this.grid.Model.SelectedRanges.ActiveRange; if(info.IsRows) { Console.WriteLine("Row Selection"); } else if(info.IsCols ) { Console.WriteLine("Column Selection"); } else if(info.IsTable ) { Console.WriteLine("Table Selection"); } else if(info.IsCells) { Console.WriteLine("Cell Selection"); } else Console.WriteLine("Empty Selection"); Let me know if this helps. Best Regards, Haneef

Loader.
Up arrow icon