Gridview Newvalues are empy after editing

G

Guest

Hi
I'm having a problem getting the newvalues or oldvalues from the RowUpdating
event. I have the following code for the event(See note):
Protected Sub grdPOs_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdPOs.RowUpdating
Dim records(e.NewValues.Count - 1) As DictionaryEntry
Dim entry As DictionaryEntry
Dim DataKeyId as DataKey
try
Dim Itm as New POItem
'Copy the new values into the fields
e.NewValues.CopyTo(records, 0)
''*******************
'Please note, that at this point there is no values in records
''*******************
For Each entry In records
e.NewValues(entry.Key) = Server.HtmlEncode(entry.Value.ToString())
Next
DataKeyId = grdPOs.DataKeys(e.RowIndex )
Itm.POId = DataKeyId("ItemId")
Itm.CatalogNumber = DataKeyId("CatalogId")
Itm.Description = DataKeyId("ItemDescription")
Itm.Qty = DataKeyId("Qty")
Itm.UnitPrice = DataKeyId("UnitPrice")
Itm.Page = DataKeyId("Page")
dim b as Boolean = Utilities.RowUpdating( Itm)
grdPOs.EditIndex = -1
BindData(pUserId)
Catch ex As Exception
msgbox("Error in POAdminEditor.grdPOs_RowUpdating: " & ex.Message )
End Try
End Sub

I use the following function to Bind the grid:
Private sub BindGrid(poOrderid as Integer )
try
'load the data and return a DataTable
Dim dt as DataTable = Utilities.BindGrid(poOrderid)
'Set the datasource
grdPOs.DataSource = dt
grdPOs.DataBind
Catch ex As Exception
msgbox("Error in POAdminEditor.BindGrid: " & ex.Message )
Finally
End Try
End Sub

I can't seem to find a solution in current posts, so I'm hoping someone can
help. Thank you much.
Michael
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top