RadGridview Change Data from View

1 Answer 14 Views
GridView
Udo
Top achievements
Rank 1
Iron
Udo asked on 18 Feb 2022, 08:35 AM

Hello,

i have a RadGridView with a TableAdapter.

The TableAdapter is Filled with a View from a SQL Database.

In a 2. Form i modified the data with a Updatecommand.

How can i update the Data in the 1 Form/GridView??

Here my Code.


    Private Sub BindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorSaveItem.Click
        'Try
        If ValidateChildren() = False Then
            Exit Sub
        End If


        Me.ObjektdatenBindingSource.EndEdit()

        Me.ObjektdatenTableAdapter.UpdateObjekt(txtObjektname.Text, rdlStrassen.Text, txtHausnummer.Text, txtPLZ.Text,
                                                   txtOrt.Text, System.DateTime.Now, CInt(rdlBegehungsintervall.SelectedValue), txtMeldernummer.Text,
                                                    picObjekt.ImageLocation, CInt(rdlobjekttyp.SelectedValue), CInt(rdlsachgebiet.SelectedValue),
                                                    rdpletzteFeuerbeschau.Value, rdpNaechsteFeuerbeschau.Value, CInt(lblObjektNr.Text))

        objekte.V_objektdatenTableAdapter.Fill(objekte._Benutzer.v_objektdaten)
        'Catch ex As Exception
        'Console.WriteLine(ex.Message)
        'End Try
    End Sub

V_objektdatenTableAdapter is the Adapter in the 1. Form

 

Thanks Udo


1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 23 Feb 2022, 07:39 AM

Hi Udo,

When the data in the database is updated the TableAdapter won't reflect the changes. You can call the Fill() method again with the respected table name after the update to reflect the changes. Afterward, you can call the Refresh() method of the RadGridView.MasterTemplate to update the control.

this.radGridView1.MasterTemplate.Refresh();

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Udo
Top achievements
Rank 1
Iron
Answers by
Dinko
Telerik team
Share this question
or