Accessing DataRow Items by Name in Edit/Update/Delete Event

Discussion in 'ASP .Net Datagrid Control' started by Marc Eggenberger, Jan 31, 2005.

  1. Hi there.

    I have a small problem with DataGrid in ASP.NET & C#.

    In the ItemDataBound Event I can use the following code

    DataRowView drvSE = (DataRowView)e.Item.DataItem;

    and then I can use
    drvSE["ColumnName"].ToString();
    to get the acutal data.

    But in the Edit/Update/Delete Events this does not work.
    The upper event has a DataGridItemEventArgs and the 3 commands where
    it's not working have a DataGridCommandEventArgs.
    They also have a e.Item.DataItem but its always null.

    How should I do this here?

    accessing the data with
    e.Item.Cells[2].Text
    works, but I dont want to hardcode the Columns position. How should I do
    it?

    --
    mfg
    Marc Eggenberger
     
    Marc Eggenberger, Jan 31, 2005
    #1
    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. Doug
    Replies:
    0
    Views:
    876
  2. Alex
    Replies:
    3
    Views:
    590
  3. =?Utf-8?B?a2Vu?=
    Replies:
    1
    Views:
    10,345
    Wiktor Zychla [C# MVP]
    Jan 23, 2006
  4. =?Utf-8?B?Tmljaw==?=

    GridView delete datarow

    =?Utf-8?B?Tmljaw==?=, Oct 4, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    4,195
    Alvin Bruney [MVP]
    Oct 6, 2006
  5. DataRow Delete Method

    , Nov 26, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    3,020
Loading...

Share This Page