Listview shows 18.000 lines when binding to an ArrayList of 10 entries

1 Answer 74 Views
ListView
Herbert
Top achievements
Rank 1
Iron
Herbert asked on 14 Aug 2021, 12:16 PM

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?

 

 

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 16 Aug 2021, 01:32 PM

Hi Herbert,

I have just sent an answer to your question in the support ticket you have opened with the same question. 

For better visibility I am pasting my answer here as well:

I have noticed that the PagedControlID of the DataPager controls is set to the ID of some other control but not to the RadListView in question:

<telerik:RadListView ID="fileList" runat="server" ItemPlaceholderID="FileInfoPlaceHolder"...>

 <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">

Please make sure that the PagedControlID is set to the Id of the RadListView and let me know if this would resolve the issue.

If this is not the case here I would suggest we proceed with the communication in the support ticket only.

Kind regards,
Doncho
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ListView
Asked by
Herbert
Top achievements
Rank 1
Iron
Answers by
Doncho
Telerik team
Share this question
or