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 new item event

Thread ID:

Created:

Updated:

Platform:

Replies:

96678 Sep 28,2010 02:16 AM Oct 12,2010 01:45 AM Windows Forms 3
loading
Tags: GridControl
nazmi anuar
Asked On September 28, 2010 02:16 AM

hi there,
Soo when im using GridDataBoundGrid and set the EnableAddNew property to true, what event should i subscribe to so that i can detect when user adding new item (by writing cell on the last row). So that i can customize the creation of the new item in the collection.


Christopher Issac Sunder K [Syncfusion]
Replied On October 4, 2010 09:33 AM

Hi Nazmi,

Thank you for your interest in Syncfusion products.

You can make use of "SourceListRecordChanging" event to identify when the user added a new record into GridGroupingControl.


this.gridGroupingControl1.SourceListRecordChanging += new RecordChangedEventHandler(gridGroupingControl1_SourceListRecordChanging);

void gridGroupingControl1_SourceListRecordChanging(object sender, RecordChangedEventArgs e)
{
if (e.Action == RecordChangedType.Added)
{
Console.WriteLine("The New Record is : " + e.Record);
Console.WriteLine("New Record Added to index : " + e.NewIndex);
}
}


Please refer the following sample which illustrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GC_Update390823270.zip

Please let me know if this helps.

Regards,
Christo.


nazmi anuar
Replied On October 7, 2010 03:14 AM

err look like GridDataBoundGrid does not have the same event.
for now i just use the event below..

void DataBoundGridModel_DataProviderSaveCellInfo(...)
{
if (this.Binder.IsAddNew)
{
....
}
}


Jisha Joy [Syncfusion]
Replied On October 12, 2010 01:45 AM

Hi Nazmi,

You could hook into the CurrencyManager's ListChanged event to track the underlying datasources changes in GridDataBoungGrid. See the code to get the values of the newly added row.



CurrencyManager cm = this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember] as CurrencyManager;
((DataView)cm.List).ListChanged += new ListChangedEventHandler(Form1_ListChanged);

private void Form1_ListChanged(object sender, ListChangedEventArgs e)
{
if(e.ListChangedType == ListChangedType.ItemAdded )
{
DataView dv = sender as DataView;
DataRowView drv = dv[e.NewIndex] as DataRowView;
Console.WriteLine(drv["SNo"]);

}
}




Sample for your reference:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBGData-12528921.zip

Please let me know if this helps.


Jisha


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.

;