DataLink.AddingNew event

DataLink.AddingNew event

Postby a_balazs » Sat 23 Nov 2013 11:14

Hi,

I would like to use this event to set specifik data on inserted DbDataRowView (like on BindingSource.AddingNew):
BindingSource:
Code: Select all
private void bindingsource_AddingNew(object s, AddingNewEventArgs e)
{
DataRowView new_rowview=(bindingsource.List as DataView).AddNew();
...
e.NewObject=new_rowview;
}


Datalink:
Code: Select all
private void datalink_AddingNew(object s, AddingNewEventArgs e)
{
DbDataRowView new_rowview=?
...
e.NewObject=new_rowview;
}

I cannot find it in the documentation. DataLink has List property with type DbDataTableView, which has no function AddNew, I can not create new DbDataRowView.

Could somebody please explain the correct method?
:?:

Balazs-
a_balazs
 
Posts: 3
Joined: Sat 23 Nov 2013 11:06

Re: DataLink.AddingNew event

Postby Pinturiccio » Tue 26 Nov 2013 13:45

Please try the following code:
Code: Select all
private void datalink_AddingNew(object s, AddingNewEventArgs e)
{
DbDataRowView new_rowview=((IBindingList)datalink.List).AddNew() as DbDataRowView;
...
e.NewObject=new_rowview;
}
Pinturiccio
Devart Team
 
Posts: 1983
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for PostgreSQL