I. Overview of the UpdatePanel control in ASP. NET AJAX Extensions
UpdatePanel can be used to create a wide range of local update Web applications, which are ASP. net ajax Extensions is a very important control. Its strength is that you do not need to write any client script. You only need to add several UpdatePanel controls and a ScriptManager control on a page to automatically implement local updates. The simple UpdatePanel definition is as follows:
- <asp:UpdatePanelIDasp:UpdatePanelID="UpdatePanel1"runat="server">
- <ContentTemplate>
- <!---->
- </ContentTemplate>
- <Triggers>
- <asp:AsyncPostBackTrigger/>
- <asp:PostBackTrigger/>
- </Triggers>
- </asp:UpdatePanel>
Ii. How UpdatePanel works
UpdatePanel depends on the ScriptManager Server Control and the client PageRequestManager class Sys. webForms. pageRequestManager, which will be specifically mentioned in later client classes). When the ScriptManager allows partial page updates, it will return it to the server asynchronously, unlike the traditional full-page return method, only the page section contained in UpdatePanel is updated. After the HTML is returned from the server, pageRequestManager replaces the code snippet to be updated by operating the DOM object.
Take a look at the working principle of UpdatePanel provided on the official website:
Iii. ContentTemplate attributes
The Contente Template label defines the content of UpdatePanel, which can contain any ASP. NET element. If you want to use a programming method to control the content in UpdatePanel, you need to use ContenteTemplateContainer.
Iv. ContentTemplateContainer attributes
If you want to use a programming method to set content in UpdatePanel, you need to create an UpdatePanel and add the control to ContentTemplateContainer, instead of adding the control to ContentTemplate. If you want to directly set ContentTemplate, you need to write a custom Template and implement it in the System. web. the interface ITemplate In the UI namespace.
5. Triggers attributes
In ASP. net ajax has two types of Triggers: AsyncPostBackTrigger and PostBackTrigger. AsyncPostBackTrigge is used to specify a server-side control and use the triggered server-side events as the asynchronous update trigger of the UpdatePanel, the property that needs to be set includes the Control ID and the event of the server control. PostBackTrigger is used to specify a Server Control in UpdatePanel. asynchronous sending is not used for the return, it is still a traditional whole-page delivery. This is very different from Atlas. Let's look at a small example. Although both buttons are placed in UpdatePanel, Button2 is still used because it is specified in PostBackTrigger. The above is an overview of the UpdatePanel control in ASP. net ajax Extensions.
- Introduction to ASP. NET data access
- Processing Process for ASP. NET Runtime
- Overview ASP. net mvc and FubuMVC core framework
- Processing Methods of ASP. NET framework
- Analysis on ASP. NET Security Architecture