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