We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

AllowNew Master Details 2 Datagrids

Hi I have a Master Detail relationship using two datagrids, very similar to the sync sample DGTripleMasterDetails. But I wish to set the AllowNew to False, works fine for the Master table in Datagrid 1 but the Details table has no effect. Any help would be great! ...here is some code CBAdapter = new OleDbDataAdapter("Select * From tblCashBook", CBConnect) ; CBAdapterSplit = new OleDbDataAdapter("Select * From tblCashBookSplit", CBConnect) ; CBDataset = new DataSet(); CBConnect.Open() ; CBAdapter.Fill(CBDataset, "tblCashBook") ; CBAdapterSplit.Fill(CBDataset, "tblCashBookSplit") ; // Set Column Styles DGCashBook_SetupColumnStyles(); DGCashBookSplit_SetupColumnStyles(); CBDataset.Relations.Add("CashBookToSplit", CBDataset.Tables["tblCashBook"].Columns["SplitNumber"], CBDataset.Tables["tblCashBookSplit"].Columns["SplitNumber"]); this.DGCashBook.DataSource = CBDataset.Tables["tblCashBook"]; this.DGCashBookSplit.DataSource = CBDataset.Tables["tblCashBook"]; this.DGCashBookSplit.DataMember = "CashBookToSplit"; this.DGCashBook.AllowNavigation = false; CBCmdBuilder = new OleDbCommandBuilder(CBAdapter); CBCmdBuilderSplit = new OleDbCommandBuilder(CBAdapterSplit); this.DGCashBook.Navigate += new NavigateEventHandler(DGCashBook_Navigate); cm = (CurrencyManager)this.BindingContext[CBDataset.Tables["tblCashBook"]]; ((DataView)cm.List).AllowNew = false; cm2 = (CurrencyManager)this.BindingContext[CBDataset.Tables["tblCashBookSplit"]]; ((DataView)cm2.List).AllowNew = false; CBDataset.Tables["tblCashBook"].ColumnChanging += new DataColumnChangeEventHandler(this.DGCashBook_ColumnChanged); CBDataset.Tables["tblCashBookSplit"].ColumnChanging += new DataColumnChangeEventHandler(this.DGCashBookSplit_ColumnChanged); CBConnect.Close();

Loader.
Live Chat Icon For mobile
Up arrow icon