因此,我在VB中創建了此ListView用戶控件,並指定了我的數據源。我使用的佈局是「單行」佈局,分頁已啓用。但是,結果恰好是該行的10列(10個窗口)。我想知道如何讓默認列爲5?我檢查了這些屬性,似乎沒有這樣的屬性來控制該行開始的列數。如何在VB中爲「單行」佈局指定ListView的列數
感謝
編輯:參考
<asp:ListView ID="ListView1" runat="server" DataSourceID="RssDataSource1">
<ItemTemplate>
<td runat="server" style="background-color:#DCDCDC;color: #000000;">
title:
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
<br />
link:
<asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' />
<br />
description:
<asp:Label ID="descriptionLabel" runat="server"
Text='<%# Eval("description") %>' />
<br />
pubDate:
<asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' />
<br />
category:
<asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
<br />
</td>
</ItemTemplate>
<AlternatingItemTemplate>
<td runat="server" style="background-color:#FFF8DC;">
title:
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
<br />
link:
<asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' />
<br />
description:
<asp:Label ID="descriptionLabel" runat="server"
Text='<%# Eval("description") %>' />
<br />
pubDate:
<asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' />
<br />
category:
<asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
<br />
</td>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr>
<td>
No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<td runat="server" style="">
title:
<asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
<br />
link:
<asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>' />
<br />
description:
<asp:TextBox ID="descriptionTextBox" runat="server"
Text='<%# Bind("description") %>' />
<br />
pubDate:
<asp:TextBox ID="pubDateTextBox" runat="server" Text='<%# Bind("pubDate") %>' />
<br />
category:
<asp:TextBox ID="categoryTextBox" runat="server"
Text='<%# Bind("category") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
</td>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr ID="itemPlaceholderContainer" runat="server">
<td ID="itemPlaceholder" runat="server">
</td>
</tr>
</table>
<div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
<EditItemTemplate>
<td runat="server" style="background-color:#008A8C;color: #FFFFFF;">
title:
<asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
<br />
link:
<asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>' />
<br />
description:
<asp:TextBox ID="descriptionTextBox" runat="server"
Text='<%# Bind("description") %>' />
<br />
pubDate:
<asp:TextBox ID="pubDateTextBox" runat="server" Text='<%# Bind("pubDate") %>' />
<br />
category:
<asp:TextBox ID="categoryTextBox" runat="server"
Text='<%# Bind("category") %>' />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
</td>
</EditItemTemplate>
<SelectedItemTemplate>
<td runat="server"
style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
title:
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
<br />
link:
<asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' />
<br />
description:
<asp:Label ID="descriptionLabel" runat="server"
Text='<%# Eval("description") %>' />
<br />
pubDate:
<asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' />
<br />
category:
<asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
<br />
</td>
</SelectedItemTemplate>
</asp:ListView>
從數據源中返回什麼?你有可能收到10個值嗎?在這種情況下,如果您只需要5列然後新建一行,則可以在代碼隱藏中執行此操作。 – 2012-02-17 17:41:19
馬騰,實際上有19條記錄。我實際上想保留單行,如果用戶想要看到超出前5條記錄,他們可以按下下一個按鈕(在ListView配置中啓用)來滑動並查看其餘數據記錄。 – eastboundr 2012-02-17 17:50:36