Click here to Skip to main content
15,923,789 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted

1 solution

Can you post some code? Its not completely obvious what's wrong. Also, are you committing the new row?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900