Client Writing
<%= Clientscript.getcallbackeventreference (This, "Arg", "func", "context")%>
Where the Func parameter is a callback function, context is also specified as the Null,this parameter for this page, and the arg parameter is the parameter to pass to the service-side function
function func (result,context)//Result returns data to the server, context is a page receive control (optional depending on its data usage)
{context.innerhtml = result}
Service-Side authoring
The service side handles the function of the client passing the data raisecallbackevent (string eventargument)//Remember that the function name is a contract and cannot be changed
string result = "";
public void RaiseCallbackEvent (String eventargument)
{
Result= eventargument;
}
The function that the server returns client data GetCallbackResult ()//function name is a convention good, cannot change
public string GetCallbackResult ()
{
return result+ "Hello";
}
Clientscript.getcallbackeventreference invoking the service-side function