我试图弄清楚为什么我的列表视图在我构建解决方案时没有显示,但它显示在 Visual Studio 中。我错过了 HTML 中的一些语法吗?当我使用 Firebug 检查代码时,没有任何代码显示它试图呈现列表视图。
ASPX 页面:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm4.aspx.vb" Inherits="WebApplication2.WebForm4"
MasterPageFile="obj/Site1.Master" ViewStateMode="Enabled" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="ContentArea">
<fieldset>
<fieldset>
<legend style="text-align: center">Vendor Results Screen</legend>
<table width="100%">
<tr>
<td align="center">
<asp:Label ID="FilterBy" runat="server" Text="Filter By: " Font-Bold="true" Font-Size="Large"></asp:Label>
<asp:DropDownList ID="dropDownFieldName" runat="server">
<asp:ListItem Text="FieldName" Value="DocumentProviderID"> </asp:ListItem>
<asp:ListItem Text="Status" Value="Status"></asp:ListItem>
<asp:ListItem Text="FieldName" Value="PDFNumber"> </asp:ListItem>
</asp:DropDownList>
<br />
</td>
</tr>
<tr>
<td align="center" style="height: 34px">
<asp:Label ID="SearchBy" runat="server" Text="Search By: " Font-Bold="true" Font-Size="Large"></asp:Label>
<asp:TextBox ID="searchBox" runat="server"></asp:TextBox>
<asp:Button ID="SearchButton" runat="server" Text="Search" />
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
<asp:ListItem Value="10">10</asp:ListItem>
<asp:ListItem Value="25">25</asp:ListItem>
<asp:ListItem Value="50" Selected="True">50</asp:ListItem>
<asp:ListItem Value="75">75</asp:ListItem>
<asp:ListItem Value="100">100</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right">
<asp:Button ID="ExportToExcel" runat="server" Text="Export To Excel" />
</td>
</tr>
</table>
</td>
</tr>
<asp:ListView ID="ListView1" runat="server" EnableViewState = "true" Visible="true">
<LayoutTemplate>
<table cellpadding="2" width="100%" border="1" runat="server" id="tblProducts">
<tr id="Tr1" runat="server">
<th id="Th1" runat="server">
Field Name
</th>
<th id="Th2" runat="server">
Type
</th>
<th id="Th3" runat="server">
XML Path
</th>
<th id="Th4" runat="server">
Vendor Path
</th>
<th id="Th5" runat="server">
Status
</th>
<th id="Th6" runat="server">
Comments
</th>
<th id="Th7" runat="server">
Edit
</th>
<th id="Th8" runat="server">
Forms
</th>
<th id="Th9" runat="server">
CU Specific
</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
<asp:DataPager runat="server" ID="DataPager1" PageSize="50">
<Fields>
<asp:NumericPagerField ButtonCount="10" CurrentPageLabelCssClass="CurrentPage" NumericButtonCssClass="PageNumbers"
NextPreviousButtonCssClass="PageNumbers" NextPageText=" Next " PreviousPageText=" Previous " />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<tr id="Tr2" runat="server">
<td>
<asp:Label ID="FieldName" runat="Server" Text='<%#Eval("FLD_NM") %>' />
</td>
<td>
<asp:Label ID="Type" runat="Server" Text='<%#Eval("DATA_TYPE_CD") %>' />
</td>
<td>
<asp:Label ID="XMLPath" runat="Server" Text='<%#Eval("WS_XML_PATH_TX") %>' />
</td>
<td>
<asp:Label ID="VendorPath" runat="Server" Text='<%#Eval("FLD_NM") %>' />
</td>
<td>
<asp:DropDownList ID="Status" runat="Server" />
</td>
<td>
<asp:TextBox ID="Comments" runat="Server" MaxLength="100" />
</td>
<td>
<asp:LinkButton ID="EditButton" runat="Server" Text="Edit" CommandName="Edit" />
</td>
<td>
<asp:Label ID="Forms" runat="Server" Text='<%#Eval("FLD_NM") %>' />
</td>
<td>
<asp:Label ID="CUSpecific" runat="Server" Text='<%#Eval("FLD_NM") %>' />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr style="background-color: #ADD8E6">
<td>
<asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="FieldName" runat="server" Text='<%# Bind("FLD_NM") %>' MaxLength="50" /><br />
</td>
<td>
<asp:TextBox ID="DataType" runat="server" Text='<%# Bind("DATA_TYPE_CD") %>' MaxLength="50" /><br />
</td>
</tr>
</EditItemTemplate>
</asp:ListView>
</table>
</fieldset>
</fieldset>
</asp:Content>
VB:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
dataTable()
Dim dataT As DataTable = dsData
dsData = ViewState("Table")
ListView1.DataSource = dataT.AsDataView
ListView1.DataBind()
'ListView1.Sort("FLD_NM", SortDirection.Descending)
dropDownFieldName.DataSource = dsData.Columns
dropDownFieldName.DataBind()
End If
End Sub
那是我运行的 VB,我不相信 VB 是问题,因为我可以在其中设置断点并查看表格。此外,我的 dropdownFieldName(我用于搜索)显示了我想要的所有列标题。如果我遗漏了一些明显的东西,请告诉我!
谢谢你,格雷格