Atlas documents ents: updatepanel class

Source: Internet
Author: User
Notes: For the Atlas Series Article To maintain the taste of the original text, try not to delete the part during the translation process. In order to ensure readability and consistency, this article provides an English comment on some vocabulary translation. Due to limited ability, there may be omissions and mistakes in the translation and learning process. I hope you can give more advice. In general, this part of translation is only an introduction and generalization. For more details, please refer to the Atlas article in his garden.

Original article address: here
Translation: Fan weixiao

Updatepanel class
Function: Divides a page into multiple regions. Each region can update its content without refreshing the entire page (partial sending back)
Syntax: Public class updatepanel: Control

Remarks:
When a part of the page needs to be changed after sending it back, the whole page usually needs to be refreshed. updatepanel solves this problem. Through updatepanel, we can use patial update) use more frequent and multiple sending requests to Reduce screen flashes (screen flicker is triggered when the entire page is refreshed). At the same time, you can create more interactive web applications.Program.

When you use partial rendering when developing an Asp.net page, this page looks no different from common ones. The difference is that this page contains a scriptmanager control, which is used to manage partial updates. This allows updatepanel on the page to work independently without affecting each other. Of course, you can also put the updatepanel control in user control or master to use it.

When partial-rendering is used, the control can execute the original full-page regular PostBack or use an independent updatepanel asynchronous poskback ), if asynchronous sending back is allowed, you can use this function by placing the control in updatepanel. All controls other than updatepanel will cause the whole page to be sent back, but there are several exceptions:
1. components without user interfaces such as timercontrol.
2. Register with the control of the scriptmanager. registerasyncpostbackcontrol method.
3. triggers control connected to updatepanel
In these three cases, the control always performs partial sending back.

To update some parts of the page, you need to add the scriptmanager control to your page and set its partialredering attribute to true. Then, use the updatepanel control to divide the page into areas that can be updated independently, and specify a trigger condition that causes these areas to be refreshed. The content of the update area can be described in the contenttemplate in updatepanel.

When the page is loaded for the first time (render), the content of the updatepanel control is rendered and sent to the client. When a sending request is triggered, the mode attribute of each updatepanel indicates whether the updatepanel is always sent back or sent back under the control of the trigger. WhenModeWhen it is set to always, this updatepanel will be sent back at any time when the sending is triggered. When the mode is set to conditional, this updatepanel will only be sent back when the following conditions occur:
1. When the trigger connected to this updatepanel is triggered
2. When you force call the update Method

TriggersThe content of the Set specifies the event that can cause updatepanel to send back. You can use the controlvaluetrigger object to send back when the value of a control changes. You can also use the controleventtrigger object to send back when a specific event of a control is triggered.

RendermodeThe attributes have two values: inline and block. They will render the updatepanel into <span> and <div> tags respectively.

IsupdatingThe attribute is read-only and bool type. It is used to determine whether updatepanel is being updated as part of asynchronous sending. The true condition is:
1. The current request is being executed in partial sending-back mode.
2. When a client trigger is triggered
3.Update MethodExecuted

On the server side, the page lifecycle caused by asynchronous sending back is the same as normal sending back, but the content in updatepanel needs to be updated and sent to the browser.

Note::
1. You cannot put the file upload control in updatepanel because data transmission conflicts with some page updates.
2. contenttemplate is defined as a single instance template)

Updatepanel declaration Syntax:
1 < Atlas: updatepanel
2 ID = " String "
3 Mode = " Always | conditional "
4 Rendermode = " Block | inline "
5 Runat = " Server "
6 >
7 < Contenttemplate >
8 <! -- Updatepanel content -->
9 </ Contenttemplate >
10 < Triggers >
11 < Controlvaluetrigger
12 Controlid = " String "
13 Propertyname = " String "
14 />
15 < Controleventtrigger
16 Controlid = " String "
17 Eventname = " String "
18 />
19 </ Triggers >
20 </ Atlas: updatepanel >


Additional: If updatepanel is placed in user control or masterpage, you must pay attention to the scriptmanager issue. In addition, for the nesting of updatepanel, pay attention to the mode setting and the value when reading the isupdating attribute.

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.