Clientscript.getcallbackeventreference invoking the service-side function

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.