ASP.NET Ajax to use


I. Overview

AjaxThe contrast with the traditional development model, click me!

MicrosoftIn ASP.NET框架created on the basis of ASP.NET Ajaxtechnology to implement Ajax functionality. It is integrated in the ASP.NET 2.0及以上version, it is ASP.NETan extension of technology.

So, in the ASP.NETwell of Ajaxthe package, defined by the respective control it has become, in which Visual Studiothe toolbox in the development environment of Ajaxextensions which, as shown below:

Here Insert Picture Description
Because they all belong to the server control, so they should be defined <form>under the label, the label format is as follows:

    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        </div>
    </form>

Second, how to use

These controls are in use with certain rules, for example, in order to achieve ASP,NET Ajaxall the features, you must include in a page ScriptManagercontrol.

1, ScriptManager control

It is used to generate relevant client proxy script ( JavaScript), in order to be able to support access Web服务, its label is defined as follows:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

A aspx page can have only one ScriptManagercontrol

2, UpdatePanel controls

For updating the content on the page, the page needs to update the local content area must be placed UpdatePanelwithin the control, which is defined as the main area and updating the update mode, its label is defined as follows:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate></ContentTemplate>
    <Triggers></Triggers>
</asp:UpdatePanel>

Among them, ContentTemplateand Triggersfor the UpdatePanelsub-elements of the control

3, ScriptManagerProxy controls

Functions and ScriptManagercontrols the same, only applies to master pages and content pages also need Ajaxtime to distinguish between use of partial update.

Tags are defined as follows:

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>

4, Timer controls

Implement refresh functionality in the specified time interval, its label is defined as follows:

<asp:Timer ID="Timer1" runat="server" Interval="1000"></asp:Timer>

Wherein Interval属性when Timerthe key represents a time interval, in milliseconds,

5, UpdateProgress control

Used when performing asynchronous page is updated to show the execution status information, which can be text, pictures can be. In this way, you can achieve when updating data, a progress bar effect, give the user a better experience. Its label is defined as follows:

<asp:UpdateProgress ID="UpdateProgress1" runat="server"></asp:UpdateProgress>
He published 183 original articles · won praise 330 · views 40000 +

Guess you like

Origin blog.csdn.net/lesileqin/article/details/104036559