This is a migrated thread and some comments may be shown as answers.
How to make edit mode close after update
2 Answers 45 Views
This is a migrated thread and some comments may be shown as answers.
Simón
Top achievements
Rank 1
Simón asked on 01 Dec 2008, 05:35 PM
I'm trying to update the data from the grid using update_command, but after I click in the update button the edit form don't close, but the data is updated.

If I try to change the text or the visibility of a label inside the update_command to notify the update, nothing happens with the label.

I have in my code the item_updated sub, but it is never fired.

What I must do to close the edit form after the update is done?

Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
        Dim sql As String
        Dim conn As New ADODB.Connection
        Dim rs As New ADODB.Recordset


        conn.ConnectionString = ConfigurationManager.AppSettings.Get("strConexaoOracleAdodb")
        conn.Open()

        sql = "select * from pontos_digitais where cd_ponto_digital = '" & tbCdPontoDigital.Text & "'"
        rs.Open(sql, conn)

        Try
            If Not rs.EOF Then
                sql = "call SSG_PACKAGE.PONTOS_DIGITAIS_EDITAR(" & _
                    rs("id_ponto_digital").Value.ToString & ",'" & rs("cd_ponto_digital").Value.ToString & "','" & tbNmPontoDigital.Text & "','" & _
                    tbTxtPontoDigital.Text & "','" & rdcbAreas.SelectedValue & "','" & rdcbUsinaEdit.SelectedValue & "','" & _
                    rs("id_tipo").Value.ToString & "','" & rs("id_dados_tm1").Value.ToString & "','" & rs("id_dados_ons1").Value.ToString & "','" & _
                    rs("id_dados_iec1").Value.ToString & "','" & rdcbFonte1A.SelectedValue & "', null, null, null, null, 0, 1,'" & _
                    tbTxtAlarme.Text & "',0,'" & tbTxtRetorno.Text & "',1024,0,0,0,0,0,1)"

                conn.Execute(sql)

            End If
            rs.Close()
            conn.Close()
        Catch ex As Exception
            e.Canceled = True
        End Try

        Label1.Text = "Update Realizado"

    End Sub

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 01 Dec 2008, 06:43 PM
Hello Simón,

Please share the declaration of your RadGrid here. A possible reason for this behavior may be AllowAutomaticUpdates property set as true.

Alternatively I recommend you examine the following thread:
Can't Get Out of Edit Mode

Hope this helps.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Simón
Top achievements
Rank 1
answered on 02 Dec 2008, 01:17 PM
Changing the AllowAutomaticUpdates property to false solved the problem.
Thanks for the help.
Tags
Grid
Asked by
Simón
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Simón
Top achievements
Rank 1
Share this question
or