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. Image for the cookie policy date

GDBG EnableAddNew

Hi,

When I Set the EnableAddNew property to true, a new default row is added by default.
How can I disable de default new row adding.

Thanks
Simon

6 Replies

AD Administrator Syncfusion Team December 19, 2006 04:26 AM UTC

Hi Simon,

To Disable new record being added, you can use EnableAddNew property to false.

this.gridDataBoundGrid1.EnableAddNew = false

Best Regards,
Haneef


SK Simon Kakon December 19, 2006 08:53 AM UTC

Hi Hanneef,

I know it. But in my case I would Like to allow the user to add new row so I set this.gridDataBoundGrid1.EnableAddNew = true.

My question was : is it possible to prevent the gdbd to add an empty default row at the end of the grid if I set the EnableAddNew to true.

Thanks
Simon

>Hi Simon,

To Disable new record being added, you can use EnableAddNew property to false.

this.gridDataBoundGrid1.EnableAddNew = false

Best Regards,
Haneef


AD Administrator Syncfusion Team December 19, 2006 09:01 AM UTC

Hi Simon,

Yes, you can use Model.Rows.Hidden property to hide a AddNewRow in a Grid. Here is a code snippet to show this.

this.grid1.Model.Rows.Hidden[this.grid1.Model.RowCount] = true;

Best Regards,
Haneef


SK Simon Kakon December 19, 2006 09:51 AM UTC

It works fine.
But how can I always hide this row even if the user adds or remove rows.
The rowcount is not constant.

In fact is it possible to delete this row ?

Thanks

>Hi Simon,

Yes, you can use Model.Rows.Hidden property to hide a AddNewRow in a Grid. Here is a code snippet to show this.

this.grid1.Model.Rows.Hidden[this.grid1.Model.RowCount] = true;

Best Regards,
Haneef


AD Administrator Syncfusion Team December 19, 2006 10:36 AM UTC

Hi Simon,

You can handle the Model.QueryRowHeight event and set the RowHeight for AddNewRow to "ZERO". Here is a code snippet to show this.

this.gridDataBoundGrid1.Model.QueryRowHeight +=new GridRowColSizeEventHandler(Model_QueryRowHeight);

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if( e.Index == ( sender as GridModel ).RowCount )
{
e.Size = 0;
e.Handled = true;
}
}

Best Regards,
Haneef


SK Simon Kakon December 19, 2006 11:10 AM UTC

It works fine !

Thanks a lot for your help.

Simon

>Hi Simon,

You can handle the Model.QueryRowHeight event and set the RowHeight for AddNewRow to "ZERO". Here is a code snippet to show this.

this.gridDataBoundGrid1.Model.QueryRowHeight +=new GridRowColSizeEventHandler(Model_QueryRowHeight);

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if( e.Index == ( sender as GridModel ).RowCount )
{
e.Size = 0;
e.Handled = true;
}
}

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon