Multiple Column Primary key with Datagrid

Multiple Column Primary key with Datagrid

Old forum URL: forums.lhotka.net/forums/t/5790.aspx


MatthewC posted on Wednesday, November 12, 2008

Hello,

I have set up a many-to-many database relationship that needs to be edited a DataGridView in the User interface.  The table has two columns: ID1 and ID2, where both are foreign keys, and together they form the primary key for the table.  The CSLA linking seems to work for Insert.  So, my save button will succeed in calling CSLADataSource_InsertObject.  However, if I update a row, and hit save, the update method never gets called.  This works for my other forms. 

My guess is that it related to the DataKey for the grid, but I am unaware of how to fix the problem.  We are actually using an Infragistics grid, but we've also tried this with Microsoft's DataGridView.  For Infragistics, I tried setting the DataKeyField as follows:

.DataKeyField = "ID1, ID2"; 

with no success. 

Any help is appreciated,

Matthew

triplea replied on Thursday, November 13, 2008

A very simplistic suggestion but did you check to see if your row databound item's property actually gets updated (in your BO) when you change a value in that row and if the BO itself is dirty?

Copyright (c) Marimer LLC