views:

226

answers:

0

Hi All, I am creating a C# winform in DOt Net 3.5, I have a datagridview control & a few Other Controls (2 Textbox). In my DataSet there are two tables MasterParent(Code) ,MasterDetail(ParentCode). Both are related by a FkRelation. Code is an AutoIncrementing Column.

I Create a binding source (b1) & set Mastertable as a DataSource to it. Now I assign B1 as a datsource to GridView. I create another Binding Source(b2) & set b1 as datasource and fkRelation as DataMember. Now I bind, the 2 textbox controls to b2 (by using DataBindings of TextBox).

In both the binding sources, AllowNew,AllowEdit,AllowRemove is set to true.

What I want to achieve is : Whenever User Enters a new Record in datagridview, a New Row should get added in the Relation, For this I use UserAddedNew Row event of gridview & Call b2.AddNew();Also I set the FK Relation ParentCode in the textbox.

However, Once I Commit the gridview Row (i.e By moving up & down ), the Form View (i.e the texbox controls) Lose their Add new Event, and no data for b2 gets committed to the data source.

Kindly Help..