BackgroundWorker is a component that runs asynchronously as in the background. We need to create and use it along with Ajax to occupy async process.
In the previous post, I already have an example of create a BackgroundWorker example using client script, ASP .Net Ajax BackgroundWorker Example Using Client Script & PageMethods.
In this post, I use System.ComponentModel.BackgroundWorker class to run a background process. Its progress status will be showed in progress bar.
That progress bar is located inside ModalPopupExtender Ajax Control Toolkit. So when backgroundWorker is running no UI activity allowed exept that inside the ModalPopupExtender.
This example only do simple calculation. After calculation is completed the result shows on result div element. Its progress percentage showed as a progress bar.
Asp .Net makes upload file process is easy task. As long as the server upload directory has sufficient permission, we can save file to that directory. Beside that we can specify what kind of file we want to save.
AsyncFileUpload is an Ajax Control to upload file asynchronously. Click on browse/select file button and choose file location then the control will automatically upload the file to server. The file uploading results can be checked both in the server and client sides.
Its basic tag example is <ajaxToolkit:AsyncFileUpload ID=”asyncfileupload1″ runat=”server” OnClientUploadComplete=”uploadcomplete” OnClientUploadError=”uploaderror” />. It have client event
OnClientUploadComplete contains client script function that execute when upload file is success and
OnClientUploadError is same but execute when upload file is error.
Other client event is
OnClientUploadStarted executes when upload process started.
Also it have server event
UploadedFileError that execute on server when upload file is success and error respectively.
For complete description explanation about AsyncFileUpload please refer to link http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx
In this post, I will write example of AsyncFileUpload Ajax Control along with ModalPopup Extender as container. I already have example of using ModalPopupExtender Ajax Control at this link Create a PopUp Dialog with ModalPopupExtender AjaxControlToolkit
This example will only allow image (jpg, gif, png) file to be uploaded.