0

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

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

代码

<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>
4

2 回答 2

0

我删除了切片,而是将分区保留为 . 我希望按照部分方法完成它,但必须在本周完成作业。

于 2013-05-05T22:00:40.293 回答
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>
于 2013-05-05T18:26:13.943 回答