Hello,
I am using callbacks from a user control, but it looks like the client
cannot be "bound" to the server. When I try to run the callback, I get the
"object expected" JavaScript error; when debugging the JavaScript, I find
that WebForm_DoCallback is undefined.
Does anyone know what causes this? You will see from my code below that I
am merely echoing "TEST MESSAGE" back to the client.
Thank you,
Eric
// CODE BEHIND
#region ICallbackEventHandler Members & Helping Properties
private string sCallBackFunctionInvocation;
public string CallBackFunctionInvocation
{
get
{
return sCallBackFunctionInvocation;
}
}
public string GetCallbackResult()
{
return sCallBackFunctionInvocation;
}
public void RaiseCallbackEvent(string eventArgument)
{
sCallBackFunctionInvocation = eventArgument;
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
sCallBackFunctionInvocation =
this.Page.ClientScript.GetCallbackEventReference(t his,
"parm", "ShowMessage", "context", true);
}
// JAVASCRIPT CODE
<script language="javascript" type="text/javascript">
function ShowMessage(msg, context)
{
alert(msg);
}
function CallServer()
{
var parm = 'TEST MESSAGE';
var context = '';
<%= CallBackFunctionInvocation %>
// This renders as:
// WebForm_DoCallback('myCtl',parm,ShowMessage,contex t,null,true)
}
CallServer();
//-->
</script> 1 6453
Stupid, stupid. The problem was that, on the containing page, my user
control was not in a <form> tag with an id and runat="server".
Eric
"Eric" wrote: Hello,
I am using callbacks from a user control, but it looks like the client cannot be "bound" to the server. When I try to run the callback, I get the "object expected" JavaScript error; when debugging the JavaScript, I find that WebForm_DoCallback is undefined.
Does anyone know what causes this? You will see from my code below that I am merely echoing "TEST MESSAGE" back to the client.
Thank you,
Eric // CODE BEHIND
#region ICallbackEventHandler Members & Helping Properties
private string sCallBackFunctionInvocation; public string CallBackFunctionInvocation { get { return sCallBackFunctionInvocation; } } public string GetCallbackResult() { return sCallBackFunctionInvocation; } public void RaiseCallbackEvent(string eventArgument) { sCallBackFunctionInvocation = eventArgument; } #endregion
protected void Page_Load(object sender, EventArgs e) { sCallBackFunctionInvocation = this.Page.ClientScript.GetCallbackEventReference(t his, "parm", "ShowMessage", "context", true); }
// JAVASCRIPT CODE
<script language="javascript" type="text/javascript"> function ShowMessage(msg, context) { alert(msg); } function CallServer() { var parm = 'TEST MESSAGE'; var context = ''; <%= CallBackFunctionInvocation %> // This renders as: // WebForm_DoCallback('myCtl',parm,ShowMessage,contex t,null,true) } CallServer(); //--> </script> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RU |
last post by:
Hi,
I am working on a porting project to port C/C++ application from
unixware C++, AT&T Standard components to g++ with STL on Linux. This
application has been working properly on...
|
by: Stu |
last post by:
I am trying to build the xerces shared library with 2.3.0 version of
their source code on an AIX 5.1 32 bit machine with the following
version of the g++ compiler
/usr/local/bin/g++ -v
Reading...
|
by: Mike |
last post by:
I am having a problem when a field is spaces being undefined. I wasn't
sure if the problem was Excel or Javascript, so I thought I would post
here first.
The users are able to select from a drop...
|
by: Foolster41 |
last post by:
I'm rather new to C++ programing. I'm using the dev-C++ program on a
windows XP OS. I'm trying to compile the code for a multi user dungeon
(MUD) called circle-mud.
When I compile I get the...
|
by: Chris Beall |
last post by:
If you want your code to be bulletproof, do you have to explicitly check
for the existence of any possibly-undefined variable?
Example: window.outerHeight is defined by some browsers, but not...
|
by: matty |
last post by:
Hi,
I recently got very confused (well that's my life) about the
"undefined" value. I looked in the FAQ and didn't see anything about
it. On...
|
by: Michael Sgier |
last post by:
Hi
i get thousands of messages like below. How shall i resolve that?
Thanks
Mcihael
Release/src/Utility/RawImage.o: In function `CMaskImage::CMaskImage(int,
int, char const*)':...
|
by: VK |
last post by:
(see the post by ASM in the original thread; can be seen at
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b>
as an option)
As that is not in relevance to...
|
by: cityzen.2000 |
last post by:
Hello all
I have a web page that has a bunch of links implemented in Javascript,
each of which calls back to the code-behind page via a
Webform_DoCallback call.
My problem is this:
When I am...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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,...
|
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,...
|
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...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |