0
votes

I have a GidView with a bindingdatasource. The datatable for the GridView is populated by a selectstatement via a MySQL database.

The data in the Gridview is edited in a form with some textboxes and comboboxes. When I select a row in my GridView the data for that record can be edited. When the editing is done, the data will be updated after clicking a button. The data is saved in the database correctly, but in my GridView the updatet data is not visible. When I re-populate the GridView from the database the edited data is visible.

I tried to manualy edit the data in the datatable, but then other fields in the datatable are not updating.

Dim intTableRow As Integer

        For i As Integer = 0 To table.Rows.Count - 1
            If table.Rows(i)("artikelId") = intArtikelId Then
                intTableRow = i
                Exit For
            End If
        Next

        table.Rows(intTableRow).BeginEdit()
        If Not GridViewArtikelen.GetRowCellValue(intRow, "certificaatId") Is DBNull.Value Then
            table.Rows(intTableRow)("certificaat_geldig_tot") = DateAdd(DateInterval.Year, CDbl(txtGeldigheidsduurCertificaat.Text), table.Rows(intTableRow)("datum_certificaat"))
            ''table.Rows(intTableRow)("geldigheidsduur") = CDec(Val(txtGeldigheidsduur.Text))
            'table.Rows(intTableRow).EndEdit()
        End If

Is this because I corrupt my datarow of the datatable or do I something wrong?

1
Are you using the built-in GridControl EditForm capability or your own custom made edit form? - Brendon
I figured it out after puzzling for a long time. When the last textfield of my form was focussed the datatable of the GridView could not updated correctly. That value in the field became 0. When I changed te focus before I did the updatestatement to the database, everything was going perfect. The datatable was updated correctly. - Bjorn M

1 Answers

0
votes

I figured it out after puzzling for a long time. When the last textfield of my form was focussed the datatable of the GridView could not updated correctly. That value in the field became 0. When I changed te focus before I did the updatestatement to the database, everything was going perfect. The datatable was updated correctly.