M
Mark
I've a couple of questions to ask about callbacks in ASP.NET 2.0.
Apparently they changed since beta 2 (and those in charge of the MSDN
didn't get notified), because RaiseCallbackEvent() now returns void and
there's a new method in ICallbackEventHandler called
GetCallbackResult(). That's not so big a deal, I can make a new global
var to hold the argument (given to RaiseCallbackEvent) and use it in
GetCallbackResult.
However, one thing really does bother me. The code goes to all the
bother of gathering up all the form values to post together with the
callback data, which is great. I want to know in RaiseCallbackEvent all
the new values on the form (otherwise I'd have to put them all together
in the eventArgument parameter and parse them out on the server).
However, wasn't I surprised to learn that it gathers up all the form
data -only- when the page loads, and never again.
At the bottom of my page gets written out the following:
<script type="text/javascript">
<!--
WebForm_InitCallback();// -->
</script>
I figured I could just call this before I ran my callback. Wrong again.
This function relies on two variables, __theFormPostData and
__theFormPostCollection, which it does not bother to clear. In order to
get up-to-date values for my server-side controls in RaiseCallbackEvent
I have to do the following:
function CallServer(arg, context)
{
__theFormPostData = "";
__theFormPostCollection = new Array();
WebForm_InitCallback();
WebForm_DoCallback('__Page',arg,callback,context,null,false);
}
This all seems somewhat wrong to me. Am I trying to do something here
that was never forseen? Was this set up this way on purpose?
Mark
Apparently they changed since beta 2 (and those in charge of the MSDN
didn't get notified), because RaiseCallbackEvent() now returns void and
there's a new method in ICallbackEventHandler called
GetCallbackResult(). That's not so big a deal, I can make a new global
var to hold the argument (given to RaiseCallbackEvent) and use it in
GetCallbackResult.
However, one thing really does bother me. The code goes to all the
bother of gathering up all the form values to post together with the
callback data, which is great. I want to know in RaiseCallbackEvent all
the new values on the form (otherwise I'd have to put them all together
in the eventArgument parameter and parse them out on the server).
However, wasn't I surprised to learn that it gathers up all the form
data -only- when the page loads, and never again.
At the bottom of my page gets written out the following:
<script type="text/javascript">
<!--
WebForm_InitCallback();// -->
</script>
I figured I could just call this before I ran my callback. Wrong again.
This function relies on two variables, __theFormPostData and
__theFormPostCollection, which it does not bother to clear. In order to
get up-to-date values for my server-side controls in RaiseCallbackEvent
I have to do the following:
function CallServer(arg, context)
{
__theFormPostData = "";
__theFormPostCollection = new Array();
WebForm_InitCallback();
WebForm_DoCallback('__Page',arg,callback,context,null,false);
}
This all seems somewhat wrong to me. Am I trying to do something here
that was never forseen? Was this set up this way on purpose?
Mark