DataLink.AddingNew event

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
a_balazs
Posts: 4
Joined: Sat 23 Nov 2013 11:06

DataLink.AddingNew event

Post by 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-

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: DataLink.AddingNew event

Post by 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;
}

Post Reply