开发者

In OnLoad, which of two ASP.NET controls triggered a given callback?

开发者 https://www.devze.com 2023-01-21 17:34 出处:网络
How do I differentiate between two triggers that can both POST callbacks to the page during OnLoad?The controls themselves will automatically trigger their callback handlers, but that is too late.

How do I differentiate between two triggers that can both POST callbacks to the page during OnLoad? The controls themselves will automatically trigger their callback handlers, but that is too late.

The background on my issue is probably irrelevant, but ... I am creating an ASP.NET web page and I have two controls on the page that can trigger a callback, a "change active tab" event from my DevExpress ASPxTabControl and a "update" button that changes some settings. I only want to load the conte开发者_Python百科nts on the active tab because the tabs are filled with too-heavy computations and so forth. For various reasons, this loading must happen in OnLoad() unless the tab is the one firing the callback, in which case it should happen (only) during the "active tab changed" event.


Maybe you can read the hidden fields associated with callbacks:

  • __CALLBACKID (which stores the ID of the ICallbackEventHandler control that will be recieving the callback)
  • __CALLBACKPARAM (which stores the callback's eventArgument).

You can read these values like this:

Request["__CALLBACKID"]
Request["__CALLBACKPARAM"]

If you decide to use the EventArgument, then you would have to put some value into it that you would be able to read at this point, to give you the issuing control.

0

精彩评论

暂无评论...
验证码 换一张
取 消