母版页控件 [英] Master Page Controls
问题描述
大家好,
我在一个母版页上有一个自定义控件(一个购物车控件),从中继承了一些页面.该控件具有总价格和项目数量信息,这些标签当然应该是最新的.
我的问题是:在从我的母版页继承的每个页面上,是否都存在该控件的新实例,或者对于所有页面都只有一个实例?如果仅是一个实例,仅更新母版页控件就足够了吗?如果没有,如何在没有Ajax的情况下使控件每隔1秒更新一次?
(我的意思是,如果我可以通过计时器刻度事件来解决问题的话)
Hello everybody,
I have a custom control (a shopping cart control) on a master page from which inherit some pages. The control has a total price and number of items information as labels that should be, of course, up to date .
My question is : on each of the pages that inherited from my master page, is there a new instance of the control or is only one for all pages ? And if it is only one instance, it is enough to update only the master page control? If not how could I make the control to update on 1 second interval without Ajax ?
( I mean if I could do the trick with a timer tick event )
推荐答案
这是每个页面的新实例,因此是的,您可以不必进行更新在Page_Load期间获取母版页背后的代码,或通过绑定.
(假设您没有使用UpdatePanels或任何其他与Ajax相关的技术)
问候
Espen Harlinn
It''s a new instance for each page, so yes you can get away with updating it during Page_Load for the codebehind for the master page, or by binding.
(Assuming that you are not using UpdatePanels or any other ajax related technologies)
Regards
Espen Harlinn
这篇关于母版页控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!