1

ソリューションをビルドしたときにリストビューが表示されないのに、VisualStudioに表示される理由を理解しようとしています。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" />&nbsp;
                            <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(検索に使用)には、必要なすべての列ヘッダーが表示されます。明らかな何かが足りない場合はお知らせください。

ありがとう、グレッグ

4

2 に答える 2

1

リストビューのデータソースが null です。LisView データソースが null の場合、サーバーはリスト ビューをレンダリングしません。次のサーバー側のコードを Page_Load に追加して、これを確認しました。

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If (Not IsPostBack) Then

        Dim dt As New System.Data.DataTable
        dt.Columns.Add(New System.Data.DataColumn("FLD_NM", GetType(System.Int32)))
        dt.Columns.Add(New System.Data.DataColumn("DATA_TYPE_CD", GetType(System.String)))
        dt.Columns.Add(New System.Data.DataColumn("WS_XML_PATH_TX", GetType(System.String)))

        Dim row As System.Data.DataRow
        row = dt.NewRow()
        row.Item("FLD_NM") = 1
        row.Item("DATA_TYPE_CD") = "A"
        row.Item("WS_XML_PATH_TX") = "C:\TEMP\TEMP.XML"
        dt.Rows.Add(row)

        ListView1.DataSource = dt
        ListView1.DataBind()

    End If
End Sub
于 2012-07-20T23:54:44.280 に答える