The object data source passes the client object instead of int customerId when deleting

I have a GridView and an ObjectDataSource . Everything works fine except for the Delete method. He is trying to pass a Customer object instead of CustomerId , I told him.

enter image description here

+7
source share
1 answer

You can do it as follows:

1- Add OldValuesParameterFormatString="{0}_Key" to gridview

2- Change the parameter in the ods section to: <asp:Parameter Name="customerid_Key" Type="Int32" />

3- change the parameter name in the delete method to int customerid_Key .

I hope this answer helps you. (I can not add a comment because of my reputation, then I added an answer!)

0
source share

All Articles