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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GDBG EnableAddNew

Thread ID:

Created:

Updated:

Platform:

Replies:

53650 Dec 18,2006 02:56 PM UTC Dec 19,2006 11:10 AM UTC WinForms 6
loading
Tags: GridControl
Simon Kakon
Asked On December 18, 2006 02:56 PM UTC

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

Administrator [Syncfusion]
Replied On 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

Simon Kakon
Replied On 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

Administrator [Syncfusion]
Replied On 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

Simon Kakon
Replied On 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

Administrator [Syncfusion]
Replied On 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

Simon Kakon
Replied On 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

CONFIRMATION

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.

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

;