我有一个asp页面,我在彼此旁边显示两个gridview。第一个显示良好,但我看不到第二个。当我只显示一个identic版本时,会显示两个gridview。 您可以在下面找到我的页面的aspx代码。 数据源的查询在SQL中返回一条记录,因此有数据。更改查询时,EmptyDataText也不会显示。
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table style="width:100%" class="table">
<tr>
<td style="width:50%; background-color: #2B71A5; border-style:solid; border-width:thin; border-color: Black">
<asp:Label class="LabelHeader" ID="Label1" runat="server" Text="Filter:" ></asp:Label>
<asp:TextBox ID="txtFilter" Width="30%" runat= "server" OnTextChanged="txtFilter_TextChanged" AutoPostBack="true" />
<asp:Button ID="cmdWisFilter" runat="server" Text="Wis" Width="10%" OnClick="cmdWis_Click" />
</td>
<td style="width:50%; background-color: #2B71A5; border-style:solid; border-width:thin; border-color: Black">
<asp:DropDownList ID="ddlGebruikers" runat="server" DataSourceID="SqlDataSourceUser"
DataTextField="Naam" DataValueField="Naam" AutoPostBack="true"
OnSelectedIndexChanged="ddlGebruikers_SelectedIndexChanged" />
<asp:SqlDataSource ID="SqlDataSourceUser" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlConnectionStringNoProvider %>"
SelectCommand="SELECT Naam FROM tblGebruikers">
</asp:SqlDataSource>
</td>
</tr>
</table>
<table style="width:100%" class="table">
<tr>
<td style="width:50%">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="SqlDataSource1" RowStyle-CssClass="RowStyle"
EmptyDataText="There are no data records to display." AllowPaging="True"
AllowSorting="True" Width="100%" onsorted="GridView1_Sorted"
PageSize="15" HorizontalAlign="Left" CssClass="Grid" >
<Columns>
<asp:TemplateField HeaderText="+">
<ItemTemplate>
<asp:ImageButton ID="cmdAdd" runat="server" ImageUrl="~/Images/add.ico" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="ID_Adres" runat="server" Text='<%# Bind("ID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Organisatie" HeaderText="Organisatie" ReadOnly="True" SortExpression="Organisatie" />
<asp:BoundField DataField="Adres" HeaderText="Adres" SortExpression="Adres" />
<asp:BoundField DataField="LaatstBezocht" HeaderText="Laatst bezocht" SortExpression="LaatstBezocht" />
</Columns>
<HeaderStyle HorizontalAlign="Left" />
<PagerStyle CssClass="PagerStyle" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlConnectionStringNoProvider %>"
SelectCommand="SELECT ID, Organisatie, Dienst, Adres, Postcode, Stad, Contact, Telefoon, LaatstBezocht, Bezoekfrequentie From tblInstallatieadressen order by LaatstBezocht"
DeleteCommand="DELETE FROM tblInstallatieadressen WHERE ID=@ID"
UpdateCommand="UPDATE tblInstallatieadressen SET Dienst=@Dienst, Adres=@Adres, Postcode=@Postcode, Stad=@Stad, Contact=@Contact, Telefoon=@Telefoon, LaatstBezocht=@LaatstBezocht,
Bezoekfrequentie=@Bezoekfrequentie WHERE ID=@ID" >
<DeleteParameters>
<asp:Parameter Name="ID" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Dienst" />
<asp:Parameter Name="Adres" />
<asp:Parameter Name="Postcode" />
<asp:Parameter Name="Stad" />
<asp:Parameter Name="Contact" />
<asp:Parameter Name="Telefoon" />
<asp:Parameter Name="LaatstBezocht" Type="DateTime" />
<asp:Parameter Name="Bezoekfrequentie" />
</UpdateParameters>
</asp:SqlDataSource>
</td>
<td style="width:50%">
<asp:GridView ID="GridViewPlanningGebruiker" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSourcePlanning" RowStyle-CssClass="RowStyle"
EmptyDataText="There are no data records to display." AllowPaging="True" onsorted="GridView1_Sorted"
AllowSorting="True" Width="100%" PageSize="15" HorizontalAlign="Left" CssClass="Grid" >
<Columns>
<asp:BoundField DataField="ID_Installatieadres" HeaderText="Datum gepland" SortExpression="ID_Installatieadres" />
</Columns>
<HeaderStyle HorizontalAlign="Left" />
<PagerStyle CssClass="PagerStyle" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourcePlanning" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlConnectionStringNoProvider %>"
SelectCommand="SELECT ID_Installatieadres, Gebruiker, DatumGepland from tblPlanning" >
</asp:SqlDataSource>
</td>
</tr>
</table>
这是页面内容,包含2个网格视图。