chime
Member
Datagrid not taking up dataview as a data source - solved
Hi
In my code I have a dataview which I want to bind to a datagrid
I want to use it to sort column on the datagrid itself
When using dataview make sure that you don't databind the datagrid to the dataset in properties.
Hi
In my code I have a dataview which I want to bind to a datagrid
I want to use it to sort column on the datagrid itself
VB.NET:
Public Sub BindGrid(ByVal SortField As Object)
Dim strSortOrder As String = Session("SortOrder").ToString
' Create a DataView based on the only DataTable in DataSetUsers
'Dim myDataView As DataView = DataSetInvoiceHistory.Tables(0).DefaultView
Dim myDataView As DataView = New DataView(DataSetInvoiceHistory.Tables(0))
myDataView.Sort = strSortField & " ASC"
' Display the field you are sorting and its direction
''myDataView.RowFilter = strRowFilter
' Bind the DataGrid to the sorted DataView.
DataGridInvoiceHistory.DataSource = myDataView
DataGridInvoiceHistory.DataBind()
Catch ex As Exception
End Try
End Sub
When using dataview make sure that you don't databind the datagrid to the dataset in properties.
Last edited: