The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
ADAdministrator Syncfusion Team January 17, 2007 08:42 PM UTC
Hi Charlie,
You can use the SelectionChanged event of the GridModel to detect the selected rows in a grid. Here is a code snippet to show this.
//Form Load event this.gridDataBoundGrid1.ListBoxSelectionMode = SelectionMode.MultiExtended; //Set the SelectionMode. this.gridDataBoundGrid1.Model.SelectionChanged +=new GridSelectionChangedEventHandler(Model_SelectionChanged);//Hook the event.
private void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e) { if( e.Range.IsRows)//For Row Selection.......only { DataTable dt = this.gridDataBoundGrid1.DataSource as DataTable; for(int i = e.Range.Top ;i<=e.Range.Bottom;i++) { int pos = this.gridDataBoundGrid1.Binder.RowIndexToListManagerPosition(i); Console.WriteLine("{0}th has been selected",pos); Console.WriteLine("First Column Value : " + dt.Rows[pos][0]); } } }
Best Regards, Haneef
CMCharlie MaoJanuary 17, 2007 09:57 PM UTC
Hey Haneef,
Thanks for the reponse. Is this the only way to detect which row is highlighted. Or maybe you can offer a better way. What I am trying to do is be able to edit a single cell within the datagrid. What i want is when I double click on a particular cell it pops up a window which I can then edit that cell. I thought about just detecting the entire row, but if syncfusion provides a better way, then that would be great. Thanks again.
Charlie
ADAdministrator Syncfusion Team January 17, 2007 10:54 PM UTC
Hi Charlie,
Please try the sample and let me know if you are trying something different. GDBGDataRow.zip
Best Regards, Haneef
CMCharlie MaoJanuary 18, 2007 11:05 PM UTC
Hey Haneef,
Thank you. This is exactly what I was looking for.