教你製做Web實時進度條

2021-04-08 14:13:38 字數 3484 閱讀 2581

<

body ms_positioning="

gridlayout

">

<

form id="

form1

"method="

post

"runat="

server

">

<

br>

<

br>

<

asp:button id="

button1

"runat="

server

"text="

start long task!

">

asp:button

>

form

>

body

>

伺服器端**:

using

system;

using

system.collections;

using

system.componentmodel;

using

system.data;

using

system.drawing;

using

system.web;

using

system.web.sessionstate;

using

system.web.ui;

using

system.web.ui.webcontrols;

using

system.web.ui.htmlcontrols;

using

system.text;

namespace

webprogressbar

web form designer generated code

#region

web form designer generated code

override

protected

void

oninit(eventargs e)

/**/

//////

required method for designer support - do not modify

///the contents of this method with the code editor.

///private

void

initializecomponent()

#endregion

private

void

longtask()

//任務結束

session[

"state"] 

=100;}

public

static

void

openprogressbar(system.web.ui.page page)

private

void

button1_click(

object

sender, system.eventargs e)}}

新建乙個進度條頁面progress.aspx

客戶端:

在head中加入

<

body ms_positioning="

gridlayout

">

<

form id="

form1

"method="

post

"runat="

server

">

<

asp:label id="

lblmessages

"runat="

server

">

asp:label

>

<

asp:panel id="

panelbarside

"runat="

server

"width="

300px

"borderstyle="

solid

"borderwidth="

1px"

forecolor="

silver

">

<

asp:panel id="

panelprogress

"runat="

server

"width="

10px

"backcolor="

green

">

asp:panel

>

asp:panel

>

<

asp:label id="

lblpercent

"runat="

server

"forecolor="

blue

">

asp:label

>

form

>

body

>

伺服器端:

using

system;

using

system.collections;

using

system.componentmodel;

using

system.data;

using

system.drawing;

using

system.web;

using

system.web.sessionstate;

using

system.web.ui;

using

system.web.ui.webcontrols;

using

system.web.ui.htmlcontrols;

namespace

webprogressbar

else

if(state

>0&&

state

<=10)

if(state

==100)}

web form designer generated code

#region

web form designer generated code

override

protected

void

oninit(eventargs e)

/**/

//////

required method for designer support - do not modify

///the contents of this method with the code editor.

///private

void

initializecomponent()

#endregion}}

webprogressbar.rar

Web實時進度條

先新建乙個default.aspx頁面,客戶端 伺服器端 using system using system.collections using system.componentmodel using system.data using system.drawing using system.web...

WEB進度條控制項

第一步 新建乙個類檔案guage.cs 如下 using system using system.drawing using system.web using system.web.ui using system.web.ui.webcontrols using system.componentmo...

VC進度條實時顯示

當我們在處理大程式時,常常需要耗很長時間,為了不讓使用者錯誤的認為系統已經宕機,我們要給程式新增進度條,但是大家知道如果就直接新增進度條,並在程式裡面控制它的進度,往往得到的結果是程式仍然像宕機狀態,直到處理完畢才顯示進度條進度為100 中間的過程看不到了,那麼怎麼辦呢,是為什麼呢?原因是我們處理大...