parameters and databinding (gridview)

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
 
S

Shahzad Godil

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

Shahzad Godil
Karachi-Pakistan.
 
T

tarscher

Thanks for the reply. By setting the DataKeyNames="Id" The Id got send
correctly to the delete methode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top