hi,
i need to have 5 datagrids populated via a datatble using a dataview.
the next code generates an error message in line : .DataBind()
Dim dvCurrent As DataView = New DataView(dtProduits)
dvCurrent.RowStateFilter = DataViewRowState.CurrentRows
With DataGrid2
.DataSource = dvCurrent
.DataBind()
End With
the error message is :
The DataGrid with id 'DataGrid2' could not automatically generate columns from the data source selected.voici le code complet :
Private Sub afficheProduits()
'on attache les données aux deux composants [DataGrid]
Application.Lock()
'all products view (DG1)
With DataGrid1
.DataSource = dvProduits
.DataBind()
End With
'Current products view (DataGrid2)
Dim dvCurrent As DataView = New DataView(dtProduits)
dvCurrent.RowStateFilter = DataViewRowState.CurrentRows
With DataGrid2
.DataSource = dvCurrent
.DataBind()
End With
'Deleted products view (DataGrid3)
Dim dvSupp As DataView = New DataView(dtProduits)
dvSupp.RowStateFilter = DataViewRowState.Deleted
With DataGrid3
.DataSource = dvSupp
.DataBind()
End With
'Modified products view (DataGrid4)
Dim dvModif As DataView = New DataView(dtProduits)
dvModif.RowStateFilter = DataViewRowState.ModifiedOriginal
With DataGrid4
.DataSource = dvModif
.DataBind()
End With
'Added products view (DataGrid5)
Dim dvAjout As DataView = New DataView(dtProduits)
dvAjout.RowStateFilter = DataViewRowState.Added
With DataGrid5
.DataSource = dvAjout
.DataBind()
End With
Application.UnLock()
End Sub