Hello,
I am trying to use the WebDataGrid to update some backend support tables in a small web application for our I.S. staff but having issues getting the updates to occur. No errors are being thrown but the update simply doesn't happen. I have the DataKeyFields set and the OnRowUpdating method defined as indicated in the documentation.
Upon doing some of my own research, I suspect perhaps it has something to do with the fact that my primary key is of the datatype uniqueidentifier and there is another column in the same table holding a foreign key that is also a uniqueidentifier. Apparently there are some issues using this but I'm not sure how to get around them.
Has anyone gotten the update function to work in the WebDataGrid with uniqueidentifiers as the keys?
Hi Craig,
Does your database table have a Composite Primary Key? Or is the Foreign key that you are talking about not used in the primary key for the table you are trying to update?
If the foreign key is part of the Composite key make sure you indicate it as a primary key for the table on the grid as well. This can be done like so: DataKeyFields="Column1,Column2"
If the foreign key is not part of the composite key, then try to turn off cell editing for the column that holds the foreign key. This can be done by adding a EditingColumnSetting on the Editing behavior, like so:<ig:EditingCore> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="Column 2" ReadOnly="True" /> </ColumnSettings> </ig:CellEditing> </Behaviors></ig:EditingCore>
Regards,
Olga
Hi,
No, the foreign key is not part of the primary key, as it is not a composite key. The primary key is a field (call it issueID) which is a datatype of uniqueidentifier and is automatically generated upon entry using newid().
I do have DataKeyFields set to issueID but still no luck. Note I got the updating to work perfectly with the standard .net 3.5 GridView control, which uses the same SqlDataSource control.