使用一个<asp>部分的下拉列表来更新另一个<asp>部分中的网格视图</asp> </asp>

时间:2013-05-04 11:37:42

标签: asp.net

我有上述问题,如果我在一个部分中包含下拉列表,数据源和网格视图,它可以正常工作。但我需要将网格视图放在另一个中心区域,同时将下拉列表框保持在左侧。 我希望我可以使用left1.sqldatasource或left1 / sqldatasource,但这些都不起作用。

我在中央网格视图中如何引用此下拉列表的任何想法?

CODE

<asp:Content ID="Content2" ContentPlaceHolderID="left1" runat="server">

<div id="head2">
    Start here:
     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
        <asp:ListItem>Please select Genre</asp:ListItem>        
        <asp:ListItem>Chart</asp:ListItem>
        <asp:ListItem>House</asp:ListItem>
        <asp:ListItem>Techno</asp:ListItem>
        <asp:ListItem>Dubstep</asp:ListItem>
        <asp:ListItem>Drum and Bass</asp:ListItem>
      </asp:DropDownList>        
    </div>    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="center1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$  ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [BETable1]">
    </asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="Show" HeaderText="Show" SortExpression="Show" />
            <asp:BoundField DataField="Genre" HeaderText="Genre" SortExpression="Genre" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
            <asp:BoundField DataField="Venue" HeaderText="Venue" SortExpression="Venue" />
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
        </Columns>
    </asp:GridView>
</asp:Content>

2 个答案:

答案 0 :(得分:0)

<asp:Content ID="Content2" ContentPlaceHolderID="left1" runat="server">

<div id="head2">
    Start here:
     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
        <asp:ListItem>Please select Genre</asp:ListItem>        
        <asp:ListItem>Chart</asp:ListItem>
        <asp:ListItem>House</asp:ListItem>
        <asp:ListItem>Techno</asp:ListItem>
        <asp:ListItem>Dubstep</asp:ListItem>
        <asp:ListItem>Drum and Bass</asp:ListItem>
      </asp:DropDownList>        
    </div>    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="center1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$  ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [BETable1]">
    </asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="Show" HeaderText="Show" SortExpression="Show" />
            <asp:BoundField DataField="Genre" HeaderText="Genre" SortExpression="Genre" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
            <asp:BoundField DataField="Venue" HeaderText="Venue" SortExpression="Venue" />
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
        </Columns>
    </asp:GridView>
</asp:Content>

答案 1 :(得分:0)

我删除了分区,而是将分区保留为。 我希望已经完成了部分方法,但需要必须,并且本周将分配。