我使用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