Page 1 of 1

ASP.NET - updating a label asynchronously - help!!

Posted: 24 Nov 2008, 16:15
by shiv
I've googled a lot and didn't find a solution that works for me.
Maybe you guys can help me out.

I have an ASP.NET app.
There's an Upload form to upload files.
When the Submit button is clicked, I want a label to be displayed showing the progress of the uploads.
Something like "Uploading file x of y...".

What exactly happens when the Submit button is clicked is:
(1) Looping through an HTTPFileCollection (that's where the x and y values are found).
(2) Doing a few checks to see if the files are acceptable.
(3) Calling an Oracle stored procedure to do the writing to the database.

I've gone through lots of code snippets on the net, nothing seems to work.
If lblProgress.Text just worked, it would be great, but things don't work that way!

Any help is greatly appreciated!!! :(

Re: ASP.NET - updating a label asynchronously - help!!

Posted: 01 Dec 2008, 16:01
by Hex_Rated
You need to refresh the page to get it to update. Or set autopostback property to true, but this will cause a flicker on your webpage.

Re: ASP.NET - updating a label asynchronously - help!!

Posted: 01 Dec 2008, 16:43
by Kronos
Are you using AJAX?

Re: ASP.NET - updating a label asynchronously - help!!

Posted: 01 Dec 2008, 16:53
by shiv
Kronos wrote:Are you using AJAX?
nope

Re: ASP.NET - updating a label asynchronously - help!!

Posted: 02 Dec 2008, 10:34
by shiv
shiv wrote:
Kronos wrote:Are you using AJAX?
nope
Sorry yes I am using Ajax

Re: ASP.NET - updating a label asynchronously - help!!

Posted: 02 Dec 2008, 12:13
by Kronos
The I'll first assume that you're using an updatepanel? at least for the Upload Area?

I can't remember exact details but try to search more about Callbacks for ajax, whereby you can make the panel update to get the latest details.
You can perhaps make the updatepanel request a status from the server regarding the file upload, and if anything has changed, update the panel, or, if not, do nothing.