[英]Why IsCallback doesn't work in Master page?
I am using a Master page and I have to perform a function on initial load. 我正在使用Master页面,我必须在初始加载时执行一个功能。 I'm using Ajax and devExpress controls so I have to check !IsPostback and !IsCallback. 我正在使用Ajax和devExpress控件,所以我必须检查!IsPostback和!IsCallback。 When I try to use IsCallback the intelisense doesn't work and if I write it anyway I get an error message "The name IsCallback doesn't exist in the current context". 当我尝试使用IsCallback时,intelisense不起作用,如果我仍然写它,我会收到一条错误消息“当前上下文中不存在名称IsCallback”。 However with Page.IsCallback intelisense works and no error message is given. 但是使用Page.IsCallback intelisense工作并且没有给出错误消息。
Is there an explenation for this? 这是否有一个解释? Is there a problem with checking callbacks in master pages? 检查母版页中的回调是否有问题?
Actual explanation is simple enough: MasterPage
class itself defines only IsPostback
, and does not define IsCallback
. 实际解释很简单: MasterPage
类本身只定义了IsPostback
,并没有定义IsCallback
。 Page
class on the other hand has both these properties. 另一方面, Page
class 具有这两个属性。 That is why intellisense gave you nothing in for sole IsCallback
. 这就是为什么intellisense没有给你唯一的IsCallback
。
I believe the reason behind this is that master pages are not designed to differentiate between types of requests - this job is left for pages. 我认为这背后的原因是母版页不是为了区分请求类型而设计的 - 这个工作留给了页面。 In any way callback is just a special type of postback. 无论如何,回调只是一种特殊类型的回发。 In other words IsCallback
is true only when IsPostback
is true, so IsPostback
should suffice for your need. 换句话说, IsCallback
仅在IsPostback
为true IsPostback
为真,因此IsPostback
应该足以满足您的需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.