i have 5 dropdown list and i want the gridview to get refined with each
selection.this is what i used but its not working:
a button click event that that gets a dataview to filter records then
bind
these records to the gridview.this routine then checks each
dropdown list to see which is selected,then creates a select statement
based on the selected dropdown lists,,
Protected Sub Buttonsearch_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Buttonsearch.Click
Dim dv As DataView = GetAll()
Dim condition As String = " "
If (DropDownListemployeeID.SelectedValue IsNot "--Select--
--Select--") Then
condition = "EmployeeID='" + DropDownListemployeeID.SelectedValue
+
"'"
If (DropDownListCompanyID.SelectedValue IsNot "--Select--") Then
If (condition IsNot " ") Then
condition += " and CompanyID ='" +
DropDownListCompanyID.SelectedValue +
"'"
Else
condition = "CompanyID ='" + DropDownListCompanyID.SelectedValue +
"'"
If (DropDownListCustomerID.SelectedValue IsNot "--Select--")
Then
If (condition IsNot " ") Then
condition += " and CustomerID ='" +
DropDownListCustomerID.SelectedValue +
"'"
Else
condition = "CustomerID ='" + DropDownListCustomerID.SelectedValue
+
"'"
If (DropDownListProjectID.SelectedValue IsNot
"--Select--")
Then
If (condition IsNot " ") Then
condition += " and ProjectID ='" +
DropDownListProjectID.SelectedValue +
"'"
Else
condition = "ProjectID ='" + DropDownListProjectID.SelectedValue
+
"'"
If (DropDownListATMID.SelectedValue IsNot
"--Select--")
Then
If (condition IsNot " ") Then
condition += " and ATMID ='" + DropDownListATMID.SelectedValue
+
"'"
Else
condition = "ATMID ='" + DropDownListATMID.SelectedValue
+
"'"
End If
End If
End If
End If
End If
End If
End If
End If
End If
If (condition IsNot " ") Then
dv.RowFilter = condition
GridViewHourView1.DataSource = dv
GridViewHourView1.DataBind()
End If
End Sub
your assistance will be highly appreciated.
Regards,
Tariq