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.
I'm working with a GridDataBoundGrid on a windows form, which has the "EnableAddNew" property set to true, so that the grid automatically expands 1 row at a time per the user's needs. However, I don't want the grid to expand beyond 8 rows and I'm finding the logic to be a bit tricky to prevent this. Currently I have code that looks like this:
The result is once the GridDataBoundGrid control reaches 8 rows, when you click several different cells (which clicking a given cell triggers the 'cell editing') the GridDataBoundGrid will expand to 9 rows and then shrink back to 8 rows every other click.
What is the preferred way of preventing the GridDataBoundGrid from expanding beyond a specific amount of rows? Is there a maximum rows property?
CBClay Burch Syncfusion Team March 16, 2010 04:34 PM UTC
There is no maximum rows proeprty for a GridDataBoundGrid.
If your datasource is some kind of IBindingList or DataView that supports a ListChanged event, then you can use that event to set the EnableAddNew property in a timely fashion.
void _ListChanged(object sender, ListChangedEventArgs e) { IList list = sender as IList; if (list.Count == 8) { gridDataBoundGrid1.EnableAddNew = false; } }