ASP.Net列表视图和放大器; AJAX更新面板 [英] ASP.Net Listview & AJAX Update Panel

查看:108
本文介绍了ASP.Net列表视图和放大器; AJAX更新面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个包含几个项目的缩略图列表视图,当我们点击按钮,更应该在同一个列表视图显示项目的其余部分,。我如何achive此,我不想做一个回发,我想与ASP.Net ListView和AJAX更新面板,

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,

我通过网络去了,似乎PPL发现在这个困难,你有没有在做这个有任何建议或提示,任何帮助是非常AP preciated。

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.

推荐答案

应该是相当简单的。

使用一个采取()为您最初的小样本数据绑定和满满一则没有。

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

是这样的:

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...
   }
}

这篇关于ASP.Net列表视图和放大器; AJAX更新面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆