I am trying to create a batch server update for a Telerik Grid from code behind but I am unable to retrieve the latest changes in the textbox. Within the grid I set each textbox as follows and from the code behind I am forcing to enter edit Mode from the Prerender event:
<telerik:GridBoundColumn UniqueName="ContactPerson" HeaderText="Contact Person" DataField="ContactPerson" />
Also in code behind, when the user has finished committing changes on each textbox, the following event is fired when pressing a button:
Private Sub btnShipOut_Click(sender As Object, e As System.EventArgs) Handles btnShipOut.Click
For Each item As GridItem In RadGrid2.MasterTableView.Items
If TypeOf item Is GridEditableItem Then
Dim editableItem As GridDataItem = DirectCast(item, GridDataItem)
Dim ContactPerson As String = editableItem.Cells(2).Text
End If
Next
End Sub
The code works well but I am receiving the default value on each textbox instead of the updated value entered by the user before the postback. Instead, the new values are displayed in the grid after the postback.
I also tried the following code to retrieve the values but I get an OutOfRangeException error...
Dim txtbx As TextBox = CType(editableItem("ContactPerson").Controls(0), TextBox)
Dim txtbxvalue as string = txtbx.value
Any help please?
Best regards.