Tag Archives: ModalPopupExtender

Using Asp.Net BackgroundWorker To Create Progress Bar

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.

Continue reading

Open an Url on Asp.Net ModalPopupExtender Ajax Toolkit And Alternative Approaches

Traditional javascript using window.open(url) function to open an Url on new browser window.
Developers can post a form to new window or build a data entry page. window.open(url) function is simple but if it opens new browser several times then overall application could become overwhelming.

We can use ModalPopupExtender instead of window.open function. ModalPopupExtender is an Ajax Control Toolkit to create a modal popup. Modal popup is a dialog box that always on top of a page. You cannot access parent page if modal popup still appear so you need to close it first.
I already have a blog post explaining and showing example about ModalPopupExtender, please follow this Create a PopUp Dialog with ModalPopupExtender AjaxControlToolkit

ModalPopupExtender usually has a Panel Control and inside this Panel we can have any control like label, textbox, button etc. ModalPopupExtender usually has an OK and Cancel button inside Panel.
Those OK and Cancel buttons actually close the modal popup.

The question is how can we open an Url and show it inside Modal Popup? We can just fill in the Url’s HTML source code string into Panel inside the Modal Popup.
So that we can have dynamic content on that modal popup

One way to get Url’s HTML source code is using WebRequest Class. This WebRequest Class can get the response stream of Url and we convert it to string using StreamReader Class.

Continue reading

Upload File With Asp .Net AsyncFileUpload Ajax Control Inside ModalPopupExtender

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 UploadedComplete and 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.

Continue reading