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.
How do I add a new row to the data grid?
I have also tried the code to select a row when a cell is clicked. But how do I revert it back to just selecting the cell?
CBClay Burch Syncfusion Team June 1, 2002 08:26 AM UTC
You have to add the rows to the underlying datasource. If the datagrid's datasource is a datatable, then code such as this should append rows.
DataTable dt = (DataTable) this.dataGrid1.DataSource;
//if table has two text columns
dt.Rows.Add(new object[] {"Blah1", "Blah2"});
dt.AcceptChanges();
To selectively have single row selection, you could add a bool property to the derive datagrid, and text this property in the two mouse overrides. If this property is true, execute the code that is there now. If this property is false, just call the base class for each of the mouse overrides. This should return the functionality to the default selection behavior.