Get updated values in Gridview

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.
 
J

Joe Blauth

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top