parameters and databinding (gridview)

Discussion in 'ASP .Net' started by tarscher@gmail.com, Oct 24, 2006.

  1. Guest

    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
    , Oct 24, 2006
    #1
    1. Advertising

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

    Shahzad Godil
    Karachi-Pakistan.

    <> wrote in message
    news:...
    > 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
    >
    Shahzad Godil, Oct 24, 2006
    #2
    1. Advertising

  3. Guest

    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" <> 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.
    >
    > <> wrote in messagenews:...
    >
    > > 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
    , Oct 24, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. H5N1
    Replies:
    1
    Views:
    610
    Alvin Bruney [MVP]
    Oct 8, 2006
  2. Sergei Shelukhin
    Replies:
    1
    Views:
    559
    Mark Rae
    Nov 12, 2006
  3. jobs
    Replies:
    0
    Views:
    1,599
  4. Earl Teigrob
    Replies:
    1
    Views:
    390
    Shravan
    Mar 1, 2004
  5. Databound up

    Multiple parameters in ASP control Databinding

    Databound up, Feb 1, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    739
    Databound up
    Feb 1, 2010
Loading...

Share This Page