Ajax Note 3: updateprogress

Source: Internet
Author: User
Tags time in milliseconds
Updateprogress is very simple to use, but it is very useful. The following describes how to use updateprogress first:

<1>. Add an updatepanel to the page and put a label and a button in it.
<2> Add an updateprogress control and set its associatedupdatepanelid attribute to the name of the above updatepanel.
<3> switch to the "Source" view and edit the updateprogress progresstemplate node:

<Asp: updateprogress associatedupdatepanelid = "upinq" id = "upgcuser" runat = "server">
<Progresstemplate>
<span style = "color: # ff0000 "> retrieving data </span>
</Progresstemplate>
</ASP: updateprogress>

<4> set the Click Event code of the button:
System. Threading. thread. Sleep (4000 );
<5> okay. Run the project. click the button and you will find a small rotating icon (depending on your image, of course), and a string of Red words: retrieving data. Four seconds later, automatically disappears.

It should be noted that images are not necessarily needed, and only texts are allowed. The content between progresstemplate can be edited at will and can be any element. in addition, the default value of the displayafter attribute is 500, which is a suitable value and is not recommended to be modified. this is the wait time in milliseconds. When the wait time is exceeded, it is displayed. When updatepanel is updated, it is hidden. therefore, if you set this time too short, you will see the updateprogress flash every time, which will greatly affect the user experience.

If it is a LAN application, the server will always return quickly and there is no need to use this control.

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.