asp.net Ajax Primer Series (2): Using the ScriptManager control

Source: Internet
Author: User
Tags error handling root directory

The ScriptManager control is included in the ASP.net 2.0 AJAX extensions, which is used to process all components on the page as well as page local updates, generating related client-side proxy scripts to enable access to Web Service in JavaScript, There can be only one ScriptManager control on asp.net pages that need to support asp.net ajax. In the ScriptManager control we can specify the desired script library, or specify the Web Service to be invoked through JS, and call AuthenticationService and ProfileService, as well as page error handling.

A Control Overview

The ScriptManager control is included in the ASP.net 2.0 AJAX extensions, which is used to process all components on the page as well as page local updates, generating related client-side proxy scripts to enable access to Web Service in JavaScript, There can be only one ScriptManager control on asp.net pages that need to support asp.net ajax. In the ScriptManager control we can specify the desired script library, or specify a Web Service to be invoked through JS, and specify page error handling.

Use <asp:ScriptManager/> to define a ScriptManager, simple ScriptManager definition form:

<asp:ScriptManager ID="ScriptManager1"
runat="server">
<AuthenticationService Path="" />
<ProfileService LoadProperties="" Path="" />
<Scripts>
<asp:ScriptReference/>
</Scripts>
<Services>
<asp:ServiceReference />
</Services>
</asp:ScriptManager>

The ScriptManager properties and methods are as follows:

Properties/Methods Describe
Allowcustomerror Contact the custom error configuration area <customErrors> in web.config, use it, and the default value is True
Asyncpostbackerrormessage A custom prompt error message when an error occurs in an asynchronous postback.
Asyncpostbacktimeout Timeout limit for asynchronous postbacks, with a default value of 90, in seconds
EnablePartialRendering Whether local updates to the page are supported, the default value is true, and generally do not need to be modified
ScriptMode Specifies the mode of the script that ScriptManager sends to the client, with four modes: Auto,inherit,debug,release, the default value is Auto, and the following will be said carefully.
ScriptPath Sets the root directory of all script blocks as global properties, including custom script blocks or script blocks referencing third parties. If the Path property is set in the <asp:ScriptReference/> tab in scripts, it overrides the property.
Onasyncpostbackerror The service-side processing function When an exception occurs asynchronously, where a piece of information can be captured and processed accordingly.
Onresolvescriptreference Specifies the server-side processing function of the Resolvescriptreference event, in which you can modify information about a script, such as the path, version, and so on.

Related Article

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.