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.
Unfortunately, activation email could not send to your email. Please try again.

GDBG EnableAddNew

Thread ID:

Created:

Updated:

Platform:

Replies:

53650 Dec 18,2006 09:56 AM Dec 19,2006 06:10 AM Windows Forms 6
loading
Tags: GridControl
Simon Kakon
Asked On December 18, 2006 09:56 AM

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 18, 2006 11:26 PM

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 03:53 AM

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 04:01 AM

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 04:51 AM

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 05:36 AM

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 06:10 AM

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.

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.

;