G
Guest
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(this,
"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,context,null,true)
}
CallServer();
//-->
</script>
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(this,
"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,context,null,true)
}
CallServer();
//-->
</script>