Monthly Archives: July 2012

Introduction To Asp .Net Ajax 4 (Timer)

Timer is a Asp .Net Ajax Control to do a repetitive task. It is similar with Windows Form Timer Control or in Javascript point of view is windows.setInterval method.

Timer Event is Tick. It has interval properties in miliseconds. Interval is a time between tick event triggers itself. So this tick event runs on specific interval of time.

If you want to have a repeated automatic refresh to view current information or action like auto save then you can use Timer Control.
Since it is an ajax process then page will reload partially or process will run asynchronously.


I have a Timer Example just to view clock in a panel. Every second, clock in panel will be refreshed and show current hour, minute and second.
The source code I give you is a block code because other lines are auto-generated by Visual Studio. Here is an .aspx block code:
Continue reading

Introduction To Asp .Net Ajax 3 (ScriptManagerProxy)

“ScriptManagerProxy Class enables nested components such as content pages and user controls to add script and service references to pages when a ScriptManager control is already defined in a parent element.”

As you may know by now the ScriptManager manages all resource of Asp .Net Ajax. ScriptManager is a must have control to enable Ajax functionality.
We can include service and Javascript reference inside ScriptManager.

However Asp .Net enables only one ScriptManager component at a page. If you need to add another reference then use ScriptManagerProxy instead.
This is useful when you put ScriptManager at MasterPage and then you can extend custom functionallity using ScriptManagerProxy i.e to add Ajax Client Js File in your content page.
You can have reference to common Ajax Js script or web service at MasterPage and then you add custom Js script inside your specific custom page.
Also this ScriptManagerProxy avoid wasteful resource by referencing only a web service or script that needed by a page. Not all reference is included in ScriptManagerProxy, we have only common reference in Parent ScriptManager.

I give you an example of making above scenario using ScriptManagerProxy in this post. I create a master page containing ScriptManager component that reference to a web service.
This web service will return a product stock qty balance. Also I have a content page that shows product stock using ScriptManagerProxy that reference to Js script to access the web service method.


Continue reading

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