中继器控制 asp.net

发布于 2024-10-05 05:04:43 字数 276 浏览 0 评论 0原文

我有一个中继器控件,可以为我的用户显示播放列表,该控件有时可以保存 1000 首或更多歌曲。这是一个很棒的功能,我之前使用 jQuery 进行客户端排序,但这有局限性。因此,我实现了服务器端排序,效果很好,我看到的唯一问题是,当播放列表这么长时,在回发和排序实际开始之前需要一两秒的时间。

我已经观察了 Firebug 中的操作并做了一些研究,并了解到数据绑定值没有被保留,这是有道理的。我的问题是,在 Firebug 中观看时,看起来转发器控件在开始回发之前删除了集合中的所有项目?这是真的吗?其他人也有过这样的经历吗?

I have a repeater control that displays a playlist for my users, this control can sometimes hold say 1000 or more songs. This is a great feature, I was previously using jQuery to do client side sorting, but that has limitations. So I implemented server side sorting which works great, the only issue i am seeing is that when playlist are this long it takes a second or 2 before the postback and sorting is actually started.

I have watched the actions in firebug and done some research and understand that the databound values are not preserved, which makes sence. My question is, When watching in Firebug, it looks like the repeater control removes all the items in the collection before it starts the postback? is this true have others experienced this?

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

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

发布评论

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

评论(1

小…楫夜泊 2024-10-12 05:04:43

转发器控制在回发之间完全不再存在。当您发出页面请求时,转发器控件就会被调用。它被填充等,然后呈现给浏览器。完成后,ASP.NET 将删除页面上的所有对象(或者更确切地说,垃圾收集器将在需要时获取它们。无论哪种方式,您都无法再获取它们)。

当回发发生时,它必须重新创建整个中继器。有一些机制(例如视图状态)试图使其尽可能无缝(即重新创建控件,就像您在上一个请求中留下的那样),但它们有时不会按照您期望的方式工作。

The repeater control ceases to exist entirely between postbacks. The repeater control is called into existance when you make a page request. It is populated, etc. then rendered to the browser. Once done, ASP.NET will delete all the objects on the page (or rather the garbage collector will get them when required. Either way, you can't get them any more).

When the postback happens it has to re-create the entire repeater all over again. There are some mechanisms, such as viewstate, that try to make this as seamless as possible (i.e. recreating controls just as you left them in the previous request) but they sometimes don't work the way you might expect.

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