views:

370

answers:

1

Guys,

I have to create a listview which contains thumbnails of few items, and when we click on the more button it should display rest of the items in the same listview,. how do i achive this, i dont want to do a postback and i would like to do this with ASP.Net Listview and AJAX Update Panel,

i went through the web and seems ppl are finding difficulties in this, do you have any suggestions or tips in doing this, any help is much appreciated.

+1  A: 

Should be fairly simple.

Use a Take() for your initial small sample databind and don't for the full one.

Something like:

class Blah
 {
     private const sampleNumber = 10;


   overrides OnLoad(...)
   {
    this.DataBind();
   }

   protected MoreButtonHandler(...)
   {
      this.DataBind(false);
   }


   overrides protected DataBind()
   {
    this.DataBind(true);
   }

   (shadows?) overrides protected  DataBind(bool sampleOnly)
   {

     var thumbnails = this.loadThumbnails();
     if(sampleOnly)
      thumbnails = thumbnails.Take(Blah.sampleNumber);

     this.listview.datasource = thumbnails ;
     mybase.DataBind();

   }

   private IEnumerable<Thumbnail> loadThumbnails()
   {
     etc...
   }
}
Mark Holland
Hi this is what i do for data retrieval, i just want to know if this is possible in a listview and update panel
Aneef