J
Jason
I've gathered a bunch of data from Active Directory and placed it into a
datatable ("ADTable"). I now need to sort and filter this table based on
the selection of a drop down list("ddlCategory"). How can I filter the
dataview of this datatable to display those records that match (partially or
fully) the value selected in the drop down list?
I have the following code that doesn't work, and returns zero rows (note
that 'department' is a valid column name as I've tested dvCustom.RowFilter
="department Like Information Management" and it works):
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
'Make a copy of the default dataview of the ADTable so it's refreshed to
original every time button is clicked.
Dim dvCustom As DataView = ADTable.DefaultView
dvCustom.RowFilter = "department LIKE " & "'*" &
ddlCategory.SelectedItem.Text & "*'"
'cn is another column name, is valid and works.
dvCustom.Sort = "cn"
'DGADResults is simply a datagrid that displays the dataview
DGADResults.DataSource = dvCustom
DGADResults.DataBind()
End Sub
Any help would be greatly appreciated!
Thanks in advance,
Jason
datatable ("ADTable"). I now need to sort and filter this table based on
the selection of a drop down list("ddlCategory"). How can I filter the
dataview of this datatable to display those records that match (partially or
fully) the value selected in the drop down list?
I have the following code that doesn't work, and returns zero rows (note
that 'department' is a valid column name as I've tested dvCustom.RowFilter
="department Like Information Management" and it works):
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
'Make a copy of the default dataview of the ADTable so it's refreshed to
original every time button is clicked.
Dim dvCustom As DataView = ADTable.DefaultView
dvCustom.RowFilter = "department LIKE " & "'*" &
ddlCategory.SelectedItem.Text & "*'"
'cn is another column name, is valid and works.
dvCustom.Sort = "cn"
'DGADResults is simply a datagrid that displays the dataview
DGADResults.DataSource = dvCustom
DGADResults.DataBind()
End Sub
Any help would be greatly appreciated!
Thanks in advance,
Jason