EditColumn Events methods

Discussion in 'ASP .Net' started by kuljitsingh@hotmail.com, Apr 7, 2005.

  1. Guest

    Why e.Item.DataItem("datafield") does not works in EditCommand,
    CancelCommand, and UpdateCommand whereas e.Item.Cells(12).Text works?
    Is there a way to retreive datafields of a datagrid by their fieldnames
    in these event methds???

    Scorpius

    Examnple -
    Private Sub DataGrid123_EditCommand(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    DataGrid123.EditCommand

    e.Item.Cells(12).Text 'WORKS
    e.Item.DataItem("datafield") ' DOES NOT WORKS
    , Apr 7, 2005
    #1
    1. Advertising

  2. Elton Wang Guest

    Hi kuljitsingh,

    e.Item.DataItem is from the datagrid's underlying data
    source, whereas e.Item.Cells(index) is a cell of datagrid
    itself. When postback datagrid's underlying data source is
    gone (unless you save it in Session and retrieve it from
    Session).

    HTH

    Elton Wang



    >-----Original Message-----
    >Why e.Item.DataItem("datafield") does not works in

    EditCommand,
    >CancelCommand, and UpdateCommand whereas e.Item.Cells

    (12).Text works?
    >Is there a way to retreive datafields of a datagrid by

    their fieldnames
    >in these event methds???
    >
    >Scorpius
    >
    >Examnple -
    >Private Sub DataGrid123_EditCommand(ByVal source As

    Object, ByVal e As
    >System.Web.UI.WebControls.DataGridCommandEventArgs)

    Handles
    >DataGrid123.EditCommand
    >
    > e.Item.Cells(12).Text 'WORKS
    > e.Item.DataItem("datafield") ' DOES NOT WORKS
    >
    >.
    >
    Elton Wang, Apr 8, 2005
    #2
    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. Jim Heavey

    EditColumn

    Jim Heavey, Nov 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    441
    Natty Gur
    Nov 18, 2003
  2. Thiago Temple

    CSS in EditColumn and EditItem

    Thiago Temple, Sep 12, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    106
    Thiago Temple
    Sep 12, 2003
  3. Thiago Temple

    CSS in EditColumn and EditItem

    Thiago Temple, Sep 15, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    121
    Thiago Temple
    Sep 15, 2003
  4. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    351
    Chris
    Aug 30, 2005
  5. Kenneth McDonald
    Replies:
    5
    Views:
    311
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page