How to filter using a dropdown in a gridview and display all values when
none is selected
I have a web page with 3 values (1 text box, and 2 drop-downs) and
displays result in a gridview. This is working great when the value that I
want to search is in the drop-down. However, if the user didn't select one
of the dropdownlist ( facilityCode), we would like to display all facility
codes versus only one. What is the easiest way to accomplish this? Below
is the code related to the sqldatasource:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:HCSCRMConnectionString %>"
SelectCommand="SELECT MMM_Id_Nbr, Item_Desc, Supplier_Nbr,
Supplier_Name, Stocking_Facility_Code, Reorder_Point_Qty,
BodID, Active_Ind FROM BOD_ROP_TBL WHERE (MMM_Id_Nbr =
@MMM_Id_Nbr)and active_Ind=@Active_Ind and
Stocking_Facility_Code=@FacilityCode"
UpdateCommand="UPDATE BOD_ROP_TBL SET Reorder_Point_Qty =
@Reorder_Point_Qty, Active_Ind = @Active_Ind WHERE (BodID
= @BodID)">
<SelectParameters>
<asp:FormParameter FormField="txt3MID"
Name="MMM_Id_Nbr" Type="String" />
<asp:FormParameter FormField="dropActive"
Name="Active_Ind" Type="String" />
<asp:FormParameter FormField="FacilityCode"
Name="FacilityCode" Type="String" />
</SelectParameters>
No comments:
Post a Comment