我有一个包含3个值的网页(1个文本框和2个下拉列表),并在gridview中显示结果。当我想要搜索的值在下拉列表中时,这很有用。但是,如果用户没有选择其中一个下拉列表(facilityCode),我们希望显示所有设施代码而不是一个。实现这一目标的最简单方法是什么?以下是与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>