This is a migrated thread and some comments may be shown as answers.

Insert, Update and Delete

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 01 Mar 2011, 07:00 PM
I am trying to determine how to get the original values from the record I am trying to update and what the changed values are in the code behind.  I can not figure out which event and what syntax to use to get these values when the user hits the "Update" link.  Any help would be appreciated.

Todd

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2011, 05:53 AM
Hello Todd,


I believe the following links would help you in achieving the functionality.
Updating values in-place and with edit forms
Updating values using UserControl/FormTemplate


Thanks,
Princy.
0
Todd
Top achievements
Rank 1
answered on 02 Mar 2011, 01:57 PM
Princy,
    First off, thank you very much for such a quick response. After I submitted my question I kept checking the block that was triggered and the syntax that would reveal the data in the third level of my hierarchical grid. I found that the following subroutine was where this occured and used the dataitem to retrieve the actual data from the databound control. Once again thank you for the help. Todd

Protected

 

Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

 

 

 

If e.CommandName = "ButtonPressed" Then    <--'I had a button defined in the row needed to get data to fields at this point

 

 

If TypeOf e.Item Is GridDataItem Then

 

 

Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)

 

 

 

'Dim img As Image = DirectCast(item.FindControl("imgMarketing"), Image)

 

 

Dim dataItem = DirectCast(e.Item, GridDataItem)

 

 

objclsMktMatMaintVar.WCBCAT = dataItem.Item(

"WCBCAT").Text '<--'this was brought in by SQL-db2 400 syntax to the control

 

 

objclsMktMatMaintVar.WCBCTP = dataItem.Item(

"WCBCTP").Text

 

 

objclsMktMatMaintVar.WCCMPY = dataItem.Item(

"WCCMPY").Text

 

 

objclsMktMatMaintVar.WCCOLOR = dataItem.Item(

"WCCOLOR").Text

 

 

objclsMktMatMaintVar.WCDESC = dataItem.Item(

"WCDESC").Text

 

 

objclsMktMatMaintVar.WCDLRG = dataItem.Item(

"WCDLRG").Text

 

 

objclsMktMatMaintVar.WCDORD =

CType(dataItem.Item("WCDORD").Text, Decimal)

 

 

objclsMktMatMaintVar.WCDSML = dataItem.Item(

"WCDSML").Text

 

 

objclsMktMatMaintVar.WCIDENT =

CType(dataItem.Item("WCIDENT").Text, Decimal)

 

 

objclsMktMatMaintVar.WCSIZE = dataItem.Item(

"WCSIZE").Text

 

 

objclsMktMatMaintVar.WCSTYL = dataItem.Item(

"WCSTYLE").Text

 

 

Session(

"objclsMktMatMaintVar") = objclsMktMatMaintVar

 

 

...............
End
If

 

 

End If

 

 

 

End Sub 'RadGrid1_ItemCreated

 

Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Todd
Top achievements
Rank 1
Share this question
or