EditColumn Events methods

  • Thread starter Thread starter kuljitsingh
  • Start date Start date
K

kuljitsingh

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
 
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
(e-mail address removed)
 
Back
Top