我使用dropdownlist来优化我的GridView。 Dropdownlist绑定到AccessDataSource(表类别)并有一个虚拟字段(请选择)。Gridview问题使用下拉列表
<asp:Label ID="Label1" runat="server" Text="Refine your search"></asp:Label><br />
<asp:DropDownList ID="ddlCategories" runat="server" AppendDataBoundItems="True"
AutoPostBack="True" DataSourceID="ADC_Categories" DataTextField="CatedName"
DataValueField="Categ_Id">
<asp:ListItem Value="">-- please choose --</asp:ListItem>
</asp:DropDownList>
GridView(产品表)绑定到dropdownlist并将结果分别返回到所选的dropdownlist值。但是,如果选择了虚拟字段 - 没有数据返回(从下拉列表中没有匹配的CategoryID - 它的值为空)
如何在选择虚拟字段时简单地返回GridView中的所有记录?
感谢您的任何帮助。
你的'SELECT'语句是什么样的? – pete 2012-02-04 19:50:07
SELECT [Product_Id],[ProductName],[Price],[ReleaseDate],[Promotion],[Genre_Id],[Category_Id] FROM [tblProduct] WHERE([Category_Id] =?) 正如我所提到的参数source是dropdownlist (选定值) – fn27 2012-02-04 19:55:48