Emulate Google Images search results pagination w/ ListView and RadDataPager

2 posts, 0 answers
  1. Esteban
    Esteban avatar
    3 posts
    Member since:
    Apr 2012

    Posted 03 May 2012 Link to this post

    Hi,

    I am currently working on a Media Library module for a CMS. Reading a folder in the file system I bind the results to a RadListView that has a PageSize of n (12 at the moment) in order to display its content: images.

    DirectoryInfo di = new DirectoryInfo(MediaLibPath);
    FileSystemInfo[] files = di.GetFiles();
    var fileByUploadedDate = files.OrderByDescending(f => f.CreationTime);
    ResourceLV.DataSource = files;
    ResourceLV.DataBind();

    In the RadDataPager I have a RadButton with the OnClick

    ResourceLV.PageSize += 12;
    ReloadResourceListView();

    ReloadResourceListView() rebinds the ListView. Very similar to this sample:

    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/customizingpager/defaultcs.aspx 


    What I am trying to avoid is rebind every time as there could be hundreds of images in the folder being
    read. Is it possible to have the PageSize increase sort of like google images search results.
    What would your suggestion be? What about the PageSize from Grid, could that be emulated too?

    Thanks






  2. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 07 May 2012 Link to this post

    Hello Esteban,

    The only way to append items to RadListView without rebinding the whole control is to use it with client-side binding which allows appending data to an already bound listview. You can see a sample implementation here:
    http://demos.telerik.com/aspnet-ajax/listview/examples/client/appendingdata/defaultcs.aspx

    All the best,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top