ASP.Net 列表视图和AJAX 更新面板

发布于 2024-08-12 11:47:42 字数 171 浏览 2 评论 0原文

我必须创建一个包含几个项目的缩略图的列表视图,当我们单击“更多”按钮时,它应该在同一列表视图中显示其余项目。我如何实现这一点,我不想进行回发,我想使用 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,

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

应该相当简单。

使用 Take() 进行初始小样本数据绑定,而不是完整数据绑定。

像这样的东西:

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

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...
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文