我有两个下拉列表,一个复选框和一个包含图像的gridview。 asp代码看起来像这样。
<asp:DropDownList ID="dLSubCat" runat="server"
DataSourceID="SubCat" DataTextField="NAME"
DataValueField="SUBCAT_ID"
AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SubCat" runat="server"
ConnectionString="<%$ ConnectionStrings:GalleryConnectionString %>"
SelectCommand="SELECT * FROM [SubCategory] WHERE ([CAT_ID] = @CAT_ID)">
<SelectParameters>
<asp:ControlParameter ControlID="dLCategory" Name="CAT_ID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
和
<asp:DropDownList ID="dlIconSize" runat="server" AutoPostBack="True">
<asp:ListItem>16x16</asp:ListItem>
<asp:ListItem>24x24</asp:ListItem>
<asp:ListItem>32x32</asp:ListItem>
<asp:ListItem>48x48</asp:ListItem>
<asp:ListItem>64x64</asp:ListItem>
<asp:ListItem>72x72</asp:ListItem>
<asp:ListItem>96x96</asp:ListItem>
<asp:ListItem>128x128</asp:ListItem>
</asp:DropDownList>
<asp:CheckBox ID="chKBtn" runat="server" Text="Black n White" />
和
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="SqlDataSource2">
<Columns>
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image1" runat="server"
ImageUrl='<%# "imagehandler.ashx?ID=" + Eval("ID")%>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:GalleryConnectionString %>"
EnableCaching="True"
SelectCommand="SELECT * FROM [Icon]"
FilterExpression="SUBCAT_ID lIKE '{0}' OR ICON_SIZE Like '{1}' OR BLACKWHITE Like '{2}' ">
<FilterParameters>
<asp:ControlParameter ControlID = "dLSubCat"
PropertyName = "SelectedValue" />
<asp:ControlParameter ControlID = "dlIconSize"
PropertyName = "SelectedValue" />
<asp:ControlParameter ControlID = "chKBtn" PropertyName = "Checked" />
</FilterParameters></asp:SqlDataSource>
但是当我尝试从下拉列表中过滤数据时,它不会过滤显示相同数据的数据。请指导我
答案 0 :(得分:0)
ID不应该匹配吗?
<asp:ControlParameter ControlID="dLCategory"
<asp:DropDownList ID="dlIconSize"