I have al ListView with an internal datasource defined as:
<telerik:RadListView ID="fileList" runat="server" ItemPlaceholderID="FileInfoPlaceHolder"
Width="100%" EnableEmbeddedSkins="false" AllowMultiFieldSorting="False" AllowPaging="true" PageSize="50">
<LayoutTemplate>
<div style="width: 100%">
<table>
<thead>
<tr>
<td class="lvtop">
<img alt="" src="assets/spacer.gif" height="1" width="400" /></td>
<td class="lvtop">
<img alt="" src="assets/spacer.gif" height="1" width="120" /></td>
<td class="lvtop lvtopr">
<img alt="" src="assets/spacer.gif" height="1" width="90" /></td>
</tr>
<tr>
<td class="lvhead" style="white-space: nowrap">Datei</td>
<td class="lvhead" style="white-space: nowrap">Aktion</td>
<td class="lvhead lvheadr" style="text-align: center; width: 80px; white-space: nowrap">Start</td>
</tr>
<tr>
<td class="lvhead">
<img alt="" src="assets/spacer.gif" height="1" width="400" /></td>
<td class="lvhead">
<img alt="" src="assets/spacer.gif" height="1" width="120" /></td>
<td class="lvhead lvheadr">
<img alt="" src="assets/spacer.gif" height="1" width="90" /></td>
</tr>
<tr>
<td colspan="3" style="text-align: center">
<telerik:RadDataPager ID="fileList_pagetop" runat="server" Culture="de-DE" SEOPagingQueryPageKey="" CssClass="lvhead" PagedControlID="artList" Skin="Outlook" PageSize="50"
BackColor="#F0F0F0" BorderColor="#D0D0D0" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana, Arial, Sans serif" ForeColor="#0456a8" Font-Size="11px">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev" FirstButtonText="Erste" LastButtonText="Zurück" />
<telerik:RadDataPagerGoToPageField CurrentPageText="Seite" TotalPageText="von" SubmitButtonText="Zeigen" TextBoxWidth="40" />
<telerik:RadDataPagerButtonField FieldType="NextLast" NextButtonText="Nächste" LastButtonText="Letzte" />
<telerik:RadDataPagerPageSizeField PageSizeText="Dateien pro Seite:" PageSizeControlType="RadDropDownList" HorizontalPosition="RightFloat" PageSizes="10,20,50" />
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</thead>
<tbody>
<tr id="FileInfoPlaceHolder" runat="server">
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" style="text-align: center">
<telerik:RadDataPager ID="fileList_pagebottom" runat="server" Culture="de-DE" SEOPagingQueryPageKey="" CssClass="lvhead" PagedControlID="artList" Skin="Outlook" PageSize="50"
BackColor="#F0F0F0" BorderColor="#D0D0D0" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana, Arial, Sans serif" ForeColor="#0456a8" Font-Size="11px">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev" FirstButtonText="Erste" LastButtonText="Zurück" />
<telerik:RadDataPagerGoToPageField CurrentPageText="Seite" TotalPageText="von" SubmitButtonText="Zeigen" TextBoxWidth="40" />
<telerik:RadDataPagerButtonField FieldType="NextLast" NextButtonText="Nächste" LastButtonText="Letzte" />
<telerik:RadDataPagerPageSizeField PageSizeText="Dateien pro Seite:" PageSizeControlType="RadDropDownList" HorizontalPosition="RightFloat" PageSizes="10,20,50" />
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</tfoot>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td class="lvcell">
<%# Container.DataItem %>
</td>
<td class="lvcell"></td>
<td class="lvcell lvcellr" style="text-align: justify; width: 90px; white-space: nowrap">
<asp:ImageButton ID="GotoButton" CommandName="Goto" CommandArgument="goto" runat="server" ImageUrl='~/assets/moveright.gif' Width="25" Height="25" ImageAlign="AbsMiddle" ToolTip="Gehe zur Produktanzeige der E-ISBN" />
</td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
<table style="width: 70%">
<tr>
<td class="labelcol"><i>Keine Dateien im Verzeichnis gefunden</i></td>
</tr>
</table>
</EmptyDataTemplate>
<ValidationSettings EnableModelValidation="False" EnableValidation="False" />
</telerik:RadListView>
This is the code to set the datasource:
Protected Sub fileList_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles fileList.NeedDataSource Dim filepath As String = appldata.getSYSTEMParam("ChapterUploadPath") Dim files As New ArrayList(Directory.GetFiles(filepath, "*.xlsx").Length) 'Dim files As New List(Of String) For Each f As String In Directory.GetFiles(filepath, "*.xlsx") files.Add(Path.GetFileName(f)) Next fileList.DataSource = files fileDirectory.Text = "Alle Dateien im Verzeichnis " & filepath & ":" End Sub
The effect is the same if I use list(of string) instead of arrayList.
The number of files read from the directory is 10. The ListView shows these then lines but indicates 1714 pages with 10 entries each. Paging is possible but only the page number changes, the list of 10 always shows in the same form.
How to reduce the listview to the real number of items present?