We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prevent EnableAddNew from expanding GridDataBroundGrid beyond a specific number of rows

Thread ID:





93477 Mar 16,2010 02:09 PM UTC Mar 16,2010 04:34 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On March 16, 2010 02:09 PM UTC


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:

void GridSubParts_CurrentCellEditingComplete(Object sender, EventArgs e)
GridDataBoundGrid grid = (GridDataBoundGrid)sender;
grid.EnableAddNew = grid.Model.RowCount <= 8 ? true : false;

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?

Clay Burch [Syncfusion]
Replied On 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;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon