O
Oka Morikawa
I have DataSet with two DataTable and DataRelation between them.
I have two DataGrids with master / detail style and additional textbox which
are bind to detail table.
ds.Tables.Add(tableCompany);
ds.Tables.Add(tableBranch);
ds.Relations.Add("Branch",
ds.Tables["Company"].Columns["CompanyID"],
ds.Tables["Branch"].Columns["CompanyID"]);
this.gridCompany.SetDataBinding(ds.Tables["Company"], "");
this.gridBranch.SetDataBinding(ds.Tables["Company"], "Branch");
this.tbCode.DataBindings.Add("Text", ds.Tables["Company"], "Branch.Code");
this.tbStreet.DataBindings.Add("Text", ds.Tables["Company"],
"Branch.Street");
Now if I update textbox tbCode of tbStreet and then click the update button
which updates DT changes back to database nothing happens BUT if I after
updating TextBox click the DG then it will update changes back to DB.
How do I make so that the TextBox will update the DT immediately it loses
focus? Do I need to use some refreshing code on TextBox.Leave event? Or some
additional code on my Update button?
Thanks,
Oka Morikawa
I have two DataGrids with master / detail style and additional textbox which
are bind to detail table.
ds.Tables.Add(tableCompany);
ds.Tables.Add(tableBranch);
ds.Relations.Add("Branch",
ds.Tables["Company"].Columns["CompanyID"],
ds.Tables["Branch"].Columns["CompanyID"]);
this.gridCompany.SetDataBinding(ds.Tables["Company"], "");
this.gridBranch.SetDataBinding(ds.Tables["Company"], "Branch");
this.tbCode.DataBindings.Add("Text", ds.Tables["Company"], "Branch.Code");
this.tbStreet.DataBindings.Add("Text", ds.Tables["Company"],
"Branch.Street");
Now if I update textbox tbCode of tbStreet and then click the update button
which updates DT changes back to database nothing happens BUT if I after
updating TextBox click the DG then it will update changes back to DB.
How do I make so that the TextBox will update the DT immediately it loses
focus? Do I need to use some refreshing code on TextBox.Leave event? Or some
additional code on my Update button?
Thanks,
Oka Morikawa