473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Callbacks in ASP.NET 2.0

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,n ull,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

Nov 20 '05 #1
1 1198
i agree with you, the behavior seems odd, but it looks like its posting the
inital values, so that the callback handler can detect onchange events.
though it hard to see how this would work on a second postback from the same
control. as there is no docs on the expected behaviour, its hard to tell.

i still can not get a simple example to run in firefox, get scripting
errors. the new model of generating the scripts is a pain for debugging and
patching.

-- bruce (sqlwork.com)

"Mark" <go******@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
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,n ull,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

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Melissa Wallis | last post by:
I have a class with 5 callbacks. Two of the callbacks work fine but the others don't. The main difference is that the callbacks that don't work are composed of a sequence of structs. I noticed a...
2
by: Mike C. Fletcher | last post by:
I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate __del__ methods (and the memory leaks they create). Looking at the docs for 2.3's weakref.ref, there's no mention of whether...
1
by: vijaya | last post by:
I've to invoke a unmanaged dll fucntion in C# which uses a callback fucntion.The unmanaged dll fucntion returns a pointer to a structure to its callback fucntion.The user should collect those...
0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
2
by: johny smith | last post by:
I cannot seem to figure out how to do instance based callbacks for some reason. I found one site on functors but I did not find it that helpful actually I just don't understand it. I have no...
5
by: Christopher Jastram | last post by:
I'm a self-taught programmer, so this might be a pretty dumb question. If it is, please point me in the right direction and I shall apologize profusely. I have a question regarding C++ and...
4
by: womanontheinside | last post by:
I have a library which was written in C, you call a function, it provides the result by a callback to specific function names. I am trying to wrap the calls to this inside a class, but this causes...
0
by: anilkoli | last post by:
I want clear cut idea about callbacks and also of delegates I have doughts about callbacks, I feel callbacks are used for 1. recursion 2. dynamically calling a perticular method out of many...
9
by: zholthran | last post by:
Hi folks, after reading several threads on this issue (-> subject) I fear that I got a problem that cannot easily be solved by the offered workarounds in an acceptable way, at least not with my...
13
by: noone | last post by:
consider the following problem: You have a C style library and API that uses callbacks to implement functionality. Examples of this are X11 API, OpenGL/GLUT...The List goes on. The power of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.