Private Sub FilterGridView()
Dim strWhere As String = "it.AcctID=" & Profile.iFAacctID
'filter on horse owners
Select Case ddlOwners.SelectedItem.Text
Case "[All]"
Case "Horse Owners Only"
strWhere = strWhere & " AND it.HorseOwner=True"
Case "Non-Horse Owners Only"
strWhere = strWhere & " AND it.HorseOwner=False"
End Select
'filter on roles
If ddlRoles.SelectedItem.Text <> "[All]" Then
strWhere = strWhere & " AND it.PeopleRoles.RoleID=" & ddlRoles.SelectedValue
End If
'filter on first letter
If ddlStartsWith.SelectedItem.Text <> "[All]" Then
strWhere = strWhere & " AND it.fldClientName LIKE '" & ddlStartsWith.SelectedItem.Text & "%'"
End If
'filter on active status
Select Case ddlActives.SelectedItem.Text
Case "[All]"
Case "Actives Only"
strWhere = strWhere & " AND it.Inactive=False"
Case "Inactives Only"
strWhere = strWhere & " AND it.Inactive=True"
End Select
'apply filter and sorting to the EntityDataSource
edsContactList.Where = strWhere
If Len(edsContactList.OrderBy) > 0 Then
edsContactList.OrderBy = edsContactList.OrderBy
Else
edsContactList.OrderBy = "it.fldClientName"
End If
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE