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

[Solved] Capture user input by RadGrid in Edit ModeBy UpdateCommand Event

3 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
johnson lim
Top achievements
Rank 1
johnson lim asked on 19 Feb 2010, 02:06 AM
Hi,
My program logic is as below:
(1).Information in RadGrid is all show in label.
(2).User click on the Edit Icon which has CommandName= "Edit".
(3). GirdView turn into Edit Mode and user key in the information in the textBox.
(4)User click on the Update icon which has CommandName ="Update" and then fire UpdateCommand event.

My problem is in the UpdateCommand Event , i am not able to get the information that has been edited by user.I can only get information that is as before edited.
The purpose to have UpdateCommand event fire is to have checking and perform update action.
Does any one has idea on this?

My Coding is as below:



[code]
Protected Sub ajaxGridPlant_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles ajaxGridPlant.UpdateCommand
       
        Dim strCompanyNo As String
        Dim strPlantName As String
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim strPlantNo As String
        Dim strLastModifiedBy As String
        Dim dteLastModifiedOn As DateTime


        Try




            strCompanyNo = CType(editedItem.FindControl("ddlCompanyNo"), RadComboBox).SelectedItem.Value

            strPlantNo = CType(editedItem.FindControl("txtPlant"), TextBox).Text

            strPlantName = CType(editedItem.FindControl("txtPlantName"), TextBox).Text

            strLastModifiedBy = CType(editedItem.FindControl("lblEditLastModifiedBy"), Label).Text
            dteLastModifiedOn = CType(editedItem.FindControl("lblEditLastModifiedOn"), Label).Text


            If strPlantNo = "" Then
                Throw New Exception("OMG!!")

            End If

            'UpdateRecord(strCompanyNo, strPlantNo, strPlantName, strLastModifiedBy, dteLastModifiedOn)

        Catch ex As Exception
            Alert(ex.Message)

        End Try
[/code]

3 Answers, 1 is accepted

Sort by
0
Erwin Floresca
Top achievements
Rank 1
answered on 19 Feb 2010, 03:41 AM
It looks like you are rebinding the grid somewhere before the updatecommand is called. how are you binding the grid?
0
Princy
Top achievements
Rank 2
answered on 19 Feb 2010, 05:24 AM
Hi  Johnson,

Could you make sure that you have not set  the AllowAutomaticDeletes / AllowAutomaticInserts/ AllowAutomaticUpdates to true.
Also please take a look at the link :

Hope this helps.Do let me know of your findings.

Thanks,
Princy

0
johnson lim
Top achievements
Rank 1
answered on 19 Feb 2010, 06:13 AM
Hi, Princy, got it !!!!
Thanks!!!
Tags
Grid
Asked by
johnson lim
Top achievements
Rank 1
Answers by
Erwin Floresca
Top achievements
Rank 1
Princy
Top achievements
Rank 2
johnson lim
Top achievements
Rank 1
Share this question
or