when deleting a row from a datagrid how do i get the cell ( 0 ) value

Discussion in 'ASP .Net Datagrid Control' started by Shaminda Illangantilaka, Jun 15, 2005.

  1. when deleting a row from a datagrid how do i get the cell ( 0 ) value of the
    spcific row, to put that value inside the SQL statement under the WHERE
    condition
    Shaminda Illangantilaka, Jun 15, 2005
    #1
    1. Advertising

  2. Shaminda Illangantilaka

    Sonu Kapoor Guest

    RE: when deleting a row from a datagrid how do i get the cell ( 0 ) va

    Cell 0 is usually the column which contains the delete/update buttons. I am
    assuming that you have an ID and want to delete with the ID in the where
    clause. For that purpose I suggest to set the ID in the DataKeyField property
    and retrieve it in the delete command via:
    DataGrid1.DataKeys(e.Item.ItemIndex) which you can use for your SQL.


    --
    Sonu Kapoor - [MCP]
    ASP.NET Moderator
    WebSite: http://www.Kapoorsolutions.com
    Blog: http://www.Kapoorsolutions.com/blog/
    ASP.NET News: http://www.Kapoorsolutions.com/reblogger/


    "Shaminda Illangantilaka" wrote:

    > when deleting a row from a datagrid how do i get the cell ( 0 ) value of the
    > spcific row, to put that value inside the SQL statement under the WHERE
    > condition
    >
    >
    >
    Sonu Kapoor, Jun 15, 2005
    #2
    1. Advertising

  3. Re: when deleting a row from a datagrid how do i get the cell ( 0 ) va

    Yes, Thanks for the info..I will try that..

    "Sonu Kapoor" <> wrote in message
    news:...
    > Cell 0 is usually the column which contains the delete/update buttons. I
    > am
    > assuming that you have an ID and want to delete with the ID in the where
    > clause. For that purpose I suggest to set the ID in the DataKeyField
    > property
    > and retrieve it in the delete command via:
    > DataGrid1.DataKeys(e.Item.ItemIndex) which you can use for your SQL.
    >
    >
    > --
    > Sonu Kapoor - [MCP]
    > ASP.NET Moderator
    > WebSite: http://www.Kapoorsolutions.com
    > Blog: http://www.Kapoorsolutions.com/blog/
    > ASP.NET News: http://www.Kapoorsolutions.com/reblogger/
    >
    >
    > "Shaminda Illangantilaka" wrote:
    >
    >> when deleting a row from a datagrid how do i get the cell ( 0 ) value of
    >> the
    >> spcific row, to put that value inside the SQL statement under the WHERE
    >> condition
    >>
    >>
    >>
    Shaminda Illangantilaka, Jun 16, 2005
    #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. Replies:
    2
    Views:
    1,313
  2. Thomasa Gregg
    Replies:
    1
    Views:
    146
    Eliyahu Goldin
    Jun 9, 2004
  3. RJ
    Replies:
    1
    Views:
    228
    Eliyahu Goldin
    Feb 17, 2005
  4. harry

    Get 2nd cell value from table row?

    harry, Jul 22, 2004, in forum: Javascript
    Replies:
    2
    Views:
    125
    Mick White
    Jul 22, 2004
  5. Cylix
    Replies:
    0
    Views:
    97
    Cylix
    Jun 13, 2006
Loading...

Share This Page