在VB.NET中使用数据库绑定两个下拉列表控件

时间:2013-06-29 07:34:26

标签: asp.net vb.net

我知道在VB.NET中将下拉列表控件与数据库绑定的方法,但如果我有两个下拉列表,我怎么能这样做呢?两个Dropdown List都来自同一个数据库,但我想在网格视图中填充的是来自Views。有人可以给我一些源代码来写或任何建议是欣赏。谢谢高级。

<asp:Label ID="Label1" runat="server" Text="Dealer Name:"></asp:Label>
      &nbsp;<asp:DropDownList ID="DropDownList1" runat="server">
        <asp:ListItem>Choose Dealer</asp:ListItem>
        <asp:ListItem>Chai</asp:ListItem>
        <asp:ListItem>Chang</asp:ListItem>
        <asp:ListItem>Aniseed</asp:ListItem>
    </asp:DropDownList>

<asp:Label ID="Label2" runat="server" Text="Recipe: "></asp:Label>
      &nbsp;<asp:DropDownList ID="DropDownList2" runat="server">
        <asp:ListItem>Choose Recipe</asp:ListItem>
        <asp:ListItem>Cake</asp:ListItem>
        <asp:ListItem>Pie</asp:ListItem>
        <asp:ListItem>spaghetti</asp:ListItem>
    </asp:DropDownList>

<asp:GridView ID="GridView1" runat="server">
    </asp:GridView>

我想要例如当选择DropDownList1的经销商和DropDownList2配方时,数据网格将显示我存储在数据库中的数据(视图)。

0 个答案:

没有答案