WebForm_DoCallback Undefined

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>
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,097
Latest member
RayE496148
Top