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.com> wrote in message
news:1161681242.229179.64430@.e3g2000cwe.googlegroups.com...
> 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.com> wrote:
> 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.com> wrote in messagenews:1161681242.229179.64430@.e3g2000c
we.googlegroups.com...
>
>
>
>
>

0 comments:

Post a Comment