parameters and databinding (gridview)

  • Thread starter Thread starter tarscher
  • Start date Start date
T

tarscher

Hi all,

I have a DataSource linked to a gridview and have delete functionality
on the gridview
The objectdatasource looks like this:
<asp:ObjectDataSource ID="TestsObjectDataSource" runat="server"
DeleteMethod="DeleteTest"
SelectMethod="GetAllTests" TypeName="DaVinci.Controller">
<DeleteParameters>
<asp:Parameter Name="Id" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>

The delete parameter is Id. When I push delete (and debug) nothing gets
deleted cos the id is always 0. I actually want to pass the id of the
row but I cannot find how to achieve this. How can i define what value
is taken for the id?

Someone has a clue?

Thanks in advance
Stijn
 
For delete, Delete will work automatically by picking ID from Grid
Keyfields. Make sure that your GridView has keyfields defined.

Shahzad Godil
Karachi-Pakistan.
 
Thanks for the reply. By setting the DataKeyNames="Id" The Id got send
correctly to the delete methode.
 
Back
Top