Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a file dialog control through which i select multiple files and click a button called upload.which reads the file validates and dumps it into the database.Loops through for the next file and does the same sequence of steps.

Now i want a label to show the status like
1/3 files uploading ..
and so on..

How to i change the label text on run time?

Note: I am working on IE7. so cannot use ajax file upload control.

sample code below:

public void upload files(string[] arrayoffilenames)
{
int intfileLoadcount=0;

foreach ( filename in arrayofFilenames)
{
intfileLoadCount = intfileLoadcount + 1;
--here i want to display like 1/5 files loading 
//Read file
//Write file to database
--here i want to display like 1/5 files loading completed
}
}
Posted
Updated 27-Sep-12 1:22am
v2

You are using server side code to upload files in postback. So, though you have controls within the loop, assigning a counter in a label will not display the changes until the whole operation done and the page is fully loaded.

So, you need something which you can interact from client side. So, Ajax is the first choice to cope up with this scenario.

Have a look to this link,
Simple AJAX File Upload[^]

Hope this clears your confusion.
cheers
 
Share this answer
 
Comments
manognya kota 27-Sep-12 14:32pm    
Thanks for the reply.Yes.I am trying to achieve this from server side. But can't I do this using a parallel thread and timer?I can't use Ajax file upload as its not supported in IE 7 and lower versions.
Sandip.Nascar 27-Sep-12 23:33pm    
No you cannot do it by timer or thread. ASP.NET differs a lot from Win Application from architectural point of view.
manognya kota 4-Oct-12 6:33am    
Any other way of showing the progress in this scenario?
Visit given URL it will help surely...

Simple AJAX File Upload[^]
 
Share this answer
 
Comments
manognya kota 4-Oct-12 6:32am    
Cant use this control in IE7 and lower versions.
<a href="<a href=""></a>[<a href="" target="_blank"></a>]"></a>
C#
<pre lang="Javascript"><pre lang="SQL"><pre lang="SQL">
 
Share this answer
 
Comments
manognya kota 27-Sep-12 10:25am    
what is this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900