----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: RanjithDotNet Message 1 in Discussion Hi, I am facing a problem with DataBinding in Master Detail Grid. Scenario Master Grid Which has two columns (CategoryID, CategoryName) Detail Grid has four columns (ItemID, CategoryID, ItemName, Qty, Price) I am using Typed Data Set which has the following Tables : Category, Item Relation : Category.Category_Item (This is an one to many relation from category to item table) I have binded the Master Grid with Category table and the Detail Table with Category.Category_Item relation. So each change in a category grid will reflect its child rows and both the grids are editable to add Categories and Items. How it works When i add a Category Name a Category Id is generated. and the row is added into the Category table. (This works fine) When i add a Item for an existing Category the Item is also getting added to the Item table, ItemID is getting generated, Item.CategoryID column of item table gets the value from the current row of category table through the Relation created in the dataset and the item row getting added to that category successfuly (This also works fine) Problem But when i add a category Name in master grid and if i directly click on the detail grid to add a new item, Item.ItemId is getting Generated, but the Items.CategoryID is NULL, so the Item row is not getting added. And I also found the problem why Items.categoryID is NULL, When u add new row to Category Table its RowState is Detached (newly added and not yet added to the Category Table Rows Collection) and now when you try to enter a new Item row in Item table through the detail grid Items.CategoryID is NULL since its parent (category table row) is now in the detached mode. And all the items added will not be related to any of the Category row (since its categoryid is null) and will get truncated while updating to the data source. Can you please give me a solution to handle this situvation (how to handle the Detached Row of master when creating new rows for child table). Thanks, Ranjith ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
