Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi There,
I have created a screen which contains a file upload contol ,Import button, cancel button.When i click on Import button it is going select a file from fileupload control, to read all the records from the file and inserts into database.
But now I want to write code for cancel button ,if i click on the cancel button it should cancel processing the file .
I dont know how to do this.
Please can anyone provide an example for this.

Thanks in advance.
Posted
Updated 28-Mar-11 22:34pm
v2

The FileUpload control a very minimal and simple upload control. When you click the upload button of your page the file will be send with the pagepostback-request of the browser. This process cannot be stopped or managed as it is part of the webbrowsers communication with the website(client requests > server answers).

The only way you are able to manage this process is to make a clientside object(flash/javascript or something like that) that will take over the communication with the website for the uploading of the file. There are a lot of examples of these kinds of upload-controls found in google, I currently don't have a good one I know of, but with a little bit of searching and testing you'll find one for you.

Multiple File Upload With Progress Bar Using Flash and ASP.NET[^]
 
Share this answer
 
Hi,
I am not sure but, you can do one thing that you can refresh the page on cancel button so what ever the process was running it will be stopped.

But i dont think so that this is the possible solution or not!!

I am sorry if i am wrong!!

Regards,
Krunal Panchal
 
Share this answer
 
Comments
willempipi 30-Mar-11 8:33am    
Creative solution;)

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