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

EnableAddNew adds to two new rows

Thread ID:

Created:

Updated:

Platform:

Replies:

19610 Sep 30,2004 07:58 AM UTC Sep 30,2004 10:03 AM UTC WinForms 5
loading
Tags: GridControl
Thiyagu
Asked On September 30, 2004 07:58 AM UTC

Hi Clay, When I try to set EnableAddNew property as True in the AddNew Button click event in my Screen, two new rows are getting added at the bottom of the Grid. User needs only one row to be added when he clicks on AddNew button... Please revert back at the Earliest.. Thanks in Advance, Thiyagu.

Administrator [Syncfusion]
Replied On September 30, 2004 08:46 AM UTC

I tried to reproduce this problem using 2.1.0.9 in the attached sample, but could not. Can you see the problem in the sample? AddNew_9770.zip

Thiyagu
Replied On September 30, 2004 09:15 AM UTC

But here what I''m trying to Do is I''m getting the Focus to newly Added row using the CurrentCell.Moveto Method.. Plz find the Modified sample as an Attachment Thiyagu.. >I tried to reproduce this problem using 2.1.0.9 in the attached sample, but could not. Can you see the problem in the sample?

Thiyagu
Replied On September 30, 2004 09:17 AM UTC

Sorry forget to attach the Sample.. Here is the Attachment.. >But here what I''m trying to Do is I''m getting the Focus to newly Added row using the CurrentCell.Moveto Method.. > >Plz find the Modified sample as an Attachment > >Thiyagu.. > > >>I tried to reproduce this problem using 2.1.0.9 in the attached sample, but could not. Can you see the problem in the sample? > AddNew_663.zip

Administrator [Syncfusion]
Replied On September 30, 2004 09:31 AM UTC

Starting an edit on the addnew row will automatically create the next addnew row. This is MS-Access type behavior, always showing an empty addnew row. If you do not want this, the simplest way to handle things is to just not use the EnableAddNew property, but instead add the row directly. You can do this using the CurrencyManager, or even the DataTable itself.
private void button1_Click(object sender, System.EventArgs e)
{
	this.gridDataBoundGrid1.Focus();
	CurrencyManager cm = (CurrencyManager) this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];
	cm.AddNew();
	this.gridDataBoundGrid1.CurrentCell.MoveTo(this.gridDataBoundGrid1.Model.RowCount,1);
	this.gridDataBoundGrid1[this.gridDataBoundGrid1.Model.RowCount,4].Text = "YES";
}

Thiyagu
Replied On September 30, 2004 10:03 AM UTC

Thanks a lot, Clay.. Its working fine. >Starting an edit on the addnew row will automatically create the next addnew row. This is MS-Access type behavior, always showing an empty addnew row. > >If you do not want this, the simplest way to handle things is to just not use the EnableAddNew property, but instead add the row directly. You can do this using the CurrencyManager, or even the DataTable itself. > >
>private void button1_Click(object sender, System.EventArgs e)
>{
>	this.gridDataBoundGrid1.Focus();
>	CurrencyManager cm = (CurrencyManager) this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];
>	cm.AddNew();
>	this.gridDataBoundGrid1.CurrentCell.MoveTo(this.gridDataBoundGrid1.Model.RowCount,1);
>	this.gridDataBoundGrid1[this.gridDataBoundGrid1.Model.RowCount,4].Text = "YES";
>}
>

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

;