EnableAddNew adds to two new rows
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.
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
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
TH
Thiyagu
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?
TH
Thiyagu
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
AD
Administrator
Syncfusion Team
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";
}
TH
Thiyagu
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";
>}
>
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
TH Thiyagu
- Sep 30, 2004 07:58 AM UTC
- Sep 30, 2004 10:03 AM UTC