I have an ObjectDataSource that is configured to use my data access layer class. The select method returns a DataTable. The DeleteMethod takes a System.Guid as a parameter. I am using a FormView object on my page that shows information from the Row of the table and allows paging. In the FormView, I also have a "delete" button with the CommandName attribute set to "Delete".
Without setting anything up, clicking the delete button would send an empty Guid to my delete method. So, I thought it was because my DataKeyNames property of the FormView was empty. So, I set the DataKeyNames property to "SystemId" which is the value from the DataRow of the current item that I would like to use as the primary key. This caused all sorts of problems basically saying that DataObjectTypeName of the the ObjectDataSource did not have a property called "SystemId". I tried adding a DeleteParameters section to the ObjectDataSource and specifying one but had no success.
Obviously, I'm missing a simple step here but I have not been able to figure it out. Below is the markup:
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
View Complete Post