Friday, March 16, 2012

parameters and databinding (gridview)

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
StijnFor delete, Delete will work automatically by picking ID from Grid
Keyfields. Make sure that your GridView has keyfields defined.

Shahzad Godil
Karachi-Pakistan.

<tarscher@.gmail.comwrote in message
news:1161681242.229179.64430@.e3g2000cwe.googlegrou ps.com...

Quote:

Originally Posted by

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
>


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

On Oct 24, 12:45 pm, "Shahzad Godil" <shahzadgo...@.gmail.comwrote:

Quote:

Originally Posted by

For delete, Delete will work automatically by picking ID from Grid
Keyfields. Make sure that your GridView has keyfields defined.
>
Shahzad Godil
Karachi-Pakistan.
>
<tarsc...@.gmail.comwrote in messagenews:1161681242.229179.64430@.e3g2000cwe.goo glegroups.com...
>

Quote:

Originally Posted by

Hi all,


>

Quote:

Originally Posted by

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>


>

Quote:

Originally Posted by

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?


>

Quote:

Originally Posted by

Someone has a clue?


>

Quote:

Originally Posted by

Thanks in advance
Stijn

0 comments:

Post a Comment