Get updated values in Gridview

  • Thread starter Thread starter Joe Blauth
  • Start date Start date
J

Joe Blauth

Hi all,

I was running into a problem with a gridview under ASP.net. What I am trying
to do is binding the DataSource dynamically in a way that enables me to edit
the rows in the Gridview. This is basically running alright except of the
fact that when I switch to "edit" in a row inside the Gridview and edit the
value and hit "update" I don't find a way to retrieve the changed values.

Here's what I did:
I placed a DataGrid control on my aspx page and bind it dynamically to a
datatable like the following:

With Me.DataGrid
.DataSource = _oClient.GetCalculationDetails(1) 'this retrieves a
datatable
.AutoGenerateEditButton = True
.DataBind()
End With

the RowEditing-Event is filled with

Me.DataGrid.EditIndex = e.NewEditIndex
DataBind()

Then, in the RowUpdating-Event I am accessing the cell values with

With sender.Rows(e.RowIndex)
_oClient.SetCalculationDetails( _
CType(.Cells(1).Controls(0).Text, Long), _
.Cells(2).Controls(0).Text.ToString, _
0, "")
End With

unfortunately I only receive the old values and had no chance to retrieve
the changed - which are obviously the displayed - values. How can I do that/
what's my mistake here ? Even the e.NewValues/ OldValues Collections appear
to be empty.

Any help highly appreciated - thanks in advance!

Joe.
 
i forgot to mention that the datatable consists of a single table query like
SELECT col1, col2 FROM dbo.tbl_Test WHERE id = x

Greets,
Joe.
 
Back
Top