Reputation: 67380
I'm using a GridView
in C#.NET 3.5 and have just converted the underlying DataSource
from Adapter
model to an object which gets its data from LINQ to SQL - i.e. a Business object that returns
a List<>
for the GetData()
function etc.
All was well in Denmark and the Update
, and conditional Select
statements work as expected but I can't get the Delete
function to work. Just trying to pass in the ID or the entire object but it's being passed in a "new" object with none of the properties set. I'm just wondering if it's the old OldValuesParameterFormatString="original_{0}"
monster in the ObjectDataSource
causing confusion again.
Anybody have any ideas?
Upvotes: 3
Views: 5158
Reputation: 67380
I found the solution. I had to set the GridView's DataKeyNames property to the unique key that my data was returning (in this case a classically named ID field). I'm guessing that this property "unset" itself when the Grid refreshed.
Upvotes: 6