Gridview Customised Delete action

Discussion in 'ASP .Net' started by Rabbit, Mar 22, 2006.

  1. Rabbit

    Rabbit Guest

    Hi,

    I'm having a GridView with Datasource being set from CodeBehind method, its
    has a "RecID" databound field set as invisible.

    I want to utilize the "Delete" commandfield, so that on gridview_RowDeleting
    event, i can perform a customised delete action.

    I've tried me.gridview.Rows(e.RowIndex).Cells(intField).Text, which only
    works for "visible" field

    My problem is now on such RowDeleting Event, I don't know how to access such
    invisible "RecID" databound field, can anyone tell me what should i do for
    achieving such field's value?
     
    Rabbit, Mar 22, 2006
    #1
    1. Advertising

  2. Rabbit

    Guest

    A GridView doesn't count invisible columns as real columns... so you
    have to go directly to the data.

    When in debug mode, set a breakpoint in the RowDataBound method (which
    yuo assigned to that event).

    Look for something like the following
    (string)((DataRowView)e.Row.DataItem)[1]

    This will get you the information in that column...
     
    , Mar 22, 2006
    #2
    1. Advertising

  3. Rabbit

    Rabbit Guest

    Thanks, I have just found another way to retrieve that invisible column,
    because its my Data Key of the record, so I set the "DataKeyNames" attribute
    of the GridView

    then on the RowDeleting event, i can use following syntax to retrieve it!
    Me.gvMaterialPO.DataKeys.Item(e.RowIndex).Value


    <> wrote in message
    news:...
    >A GridView doesn't count invisible columns as real columns... so you
    > have to go directly to the data.
    >
    > When in debug mode, set a breakpoint in the RowDataBound method (which
    > yuo assigned to that event).
    >
    > Look for something like the following
    > (string)((DataRowView)e.Row.DataItem)[1]
    >
    > This will get you the information in that column...
    >
     
    Rabbit, Mar 22, 2006
    #3
  4. Rabbit

    Guest

    Yeah that'll work too... point is that you can't just access the
    column. You have to do it via data.
     
    , Mar 22, 2006
    #4
    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. Steve Lloyd
    Replies:
    2
    Views:
    386
    Steve Lloyd
    May 19, 2004
  2. ickz
    Replies:
    1
    Views:
    342
    Esmond Pitt
    May 13, 2005
  3. riusbond

    customised login form?

    riusbond, Feb 28, 2005, in forum: C++
    Replies:
    3
    Views:
    356
    Lawrence F. Permenter
    Feb 28, 2005
  4. =?Utf-8?B?Tkg=?=

    customised gridview control?

    =?Utf-8?B?Tkg=?=, Oct 27, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    397
    Donald
    Oct 27, 2006
  5. Replies:
    3
    Views:
    372
Loading...

Share This Page