ASP.NET/C#-如何从下拉菜单控件填充Gridview

时间:2019-05-01 18:38:16

标签: asp.net

我已经从数据库中按名称填充了下拉菜单,并且我希望在从下拉菜单中选择产品之后将其产品信息填充到dropdownmenu下方。

<h1>Select The Coffee</h1><br>
    <asp:DropDownList ID="selectCoffeeDropDown" runat="server" DataSourceID="SqlDataSource1" DataTextField="product_name" DataValueField="product_name" OnSelectedIndexChanged="selectCoffeeDropDown_SelectedIndexChanged"></asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [product_name] FROM [product]"></asp:SqlDataSource>
    <li class="product">
        <a href="product_desc.aspx?ID=<%#Eval("id")  %>">
            <img src="../<%# Eval("product_images") %>" height="200" width="250" alt="" />
        </a>
        <div class="product-info">
            <h3><%# Eval("product_name") %></h3>
            <div class="product-desc">
                <h4><%# Eval("product_qty") %> oz.</h4>
                <p>
                    <%# Eval("product_desc") %><br />
                </p>
                <strong class="price">$<%# Eval("product_price") %></strong>
            </div>
        </div>
    </li>
</h1>

0 个答案:

没有答案