C# ASP.net Gridview未显示
我有一个asp页面,其中两个gridview并排显示。第一个显示良好,但我看不到第二个。当我只显示一个相同的版本时,会显示两个GridView。 下面您可以找到我的页面的aspx代码。 数据源的查询返回SQL中的记录,因此存在数据。更改查询时,EmptyDataText也不会显示C# ASP.net Gridview未显示,c#,asp.net,gridview,sqldatasource,C#,Asp.net,Gridview,Sqldatasource,我有一个asp页面,其中两个gridview并排显示。第一个显示良好,但我看不到第二个。当我只显示一个相同的版本时,会显示两个GridView。 下面您可以找到我的页面的aspx代码。 数据源的查询返回SQL中的记录,因此存在数据。更改查询时,EmptyDataText也不会显示 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style=
<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个GridView。建议您安装Stackify Prefix以帮助调试。控制台中有任何错误吗?您可以查看生成的HTML中缺少预期HTML的地方吗?您的代码正常工作,我已经用2个GridView对其进行了测试,请解释您的问题。如果您用完整的代码解释问题,效果会更好。