Simple usage of Asp.net updaeprogress

Source: Internet
Author: User

Updateprogress should mean "Update Progress.
Usage:
1. Add a scriptmanager Control
2. Add an updatepanel Control
3. Add an updateprogress Control
Set the associatedupdatepanelid of the updateprogress control to the ID of the updatepanel Step 2. (If there are multiple updatepanels on the page, only the updatepanel associated with the updatepanel is displayed)
Test example Code : Copy code The Code is as follows: <% @ page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
<% @ Register Assembly = "ajaxcontroltoolkit" namespace = "ajaxcontroltoolkit" tagprefix = "PC3" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head id = "head1" runat = "server">
<Title> untitled page </title>
<Style type = "text/CSS">
# Updatepanel1, # updatepanel2, # updateprogress1 {
Border-Right: Gray 1px solid; border-top: Gray 1px solid;
Border-left: Gray 1px solid; border-bottom: Gray 1px solid;
}
# Updatepanel1, # updatepanel2 {
Width: 200px; Height: 200px; position: relative;
Float: Left; margin-left: 10px; margin-top: 10px;
}
# Updateprogress3 {
Width: 200px; Background-color: # ffc080;
Bottom: 0%; left: 0px; position: absolute;
}
# Updateprogress2 {
Width: 200px; Background-color: # ffc080;
Bottom: 0%; left: 0px; position: absolute;
}
</Style>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Asp: scriptmanager id = "scriptmanager1" runat = "server"/>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Contenttemplate>
<Asp: button id = "button1" runat = "server" onclick = "button#click1" text = "button"/>
<Asp: Label id = "label1" runat = "server" text = "show data"> </ASP: Label>
<Asp: updateprogress id = "updateprogress1" runat = "server" associatedupdatepanelid = "updatepanel1">
<Progresstemplate>
<Div id = "progress">
Waiting...
</Div>
</Progresstemplate>
</ASP: updateprogress>
</Contenttemplate>
</ASP: updatepanel>
<Asp: updatepanel id = "updatepanel2" runat = "server">
<Contenttemplate>
<Asp: button id = "button2" runat = "server" onclick = "button2_click1" text = "button"/> <br/>
<Br/>
<Asp: Label id = "label2" runat = "server" text = "show data"> </ASP: Label>
<Asp: updateprogress id = "updateprogress2" runat = "server" associatedupdatepanelid = "updatepanel2">
<Progresstemplate>
Updating data ....
</Progresstemplate>
</ASP: updateprogress>
</Contenttemplate>
</ASP: updatepanel>
</Form>
</Body>
</Html>

C # code:Copy codeThe Code is as follows: using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using system. Threading;
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
}
Protected void button1_click1 (Object sender, eventargs E)
{
System. Threading. thread. Sleep (3000 );
Label1.text = "Refresh time:" + datetime. Now. tostring ();
}
Protected void button2_click1 (Object sender, eventargs E)
{
System. Threading. thread. Sleep (3000 );
Label2.text = "Refresh time:" + datetime. Now. tostring ();
}
}

The CSS in the page code is an example on msdn. Updateprogress1 in updatepanel1 displays a dynamic GIF Image
I would also like to give more advice to my sisters.

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.