在 PreRender 上绑定控件

发布于 2024-10-08 10:11:05 字数 105 浏览 0 评论 0原文

我一直相信绑定控件的最佳点是 PreRender。由于所有控件都已准备就绪,这是渲染等之前的最后一个阶段。这是正确的还是应该将控件绑定在不同的点?

非常感谢

路易斯

I have been led to believe that the best point to bind your controls is the PreRender. As all the controls are ready and this is the last stage before rendering etc. Is this correct or should controls be bound at a different point?

Many Thanks

Louis

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

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

发布评论

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

评论(2

新人笑 2024-10-15 10:11:05

我同意在 PreRender 进行绑定。
请参阅生命周期
正如您所看到的,PreRender 在控件事件(例如单击)之后发生,这在用户通过某种单击提交表单后必须重新绑定新的/修改的数据时至关重要。

但是,如果您不必根据用户交互性进行绑定,那么在大多数情况下,您放置的位置是无关紧要的。

不过,请不要误会,根据您的逻辑,某些绑定可能必须在控件事件之前发生,以便它们与绑定数据进行交互。

I agree with binding at PreRender.
Refer to the life cycle.
As you can see, PreRender occurs after the control events (such as clicking), which is essential when having to rebind new/modified data after the users submits the form with a click of some sort.

But if you do not have to do binding based on user interactivity, then for the most part the place you put is irrelevant.

Make no mistake, though, depending on your logic, some bindings may have to occur before the control events for them to interact with the bound data.

一抹淡然 2024-10-15 10:11:05

这是我使用的页面生活“圣经”!

http://msdn.microsoft.com/en-us/library/ms178472.aspx

我会在 Page_Load 绑定你的控件

Here is the page life "bible" that I use!

http://msdn.microsoft.com/en-us/library/ms178472.aspx

I would bind your controls at Page_Load

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