Home > DeveloperSection > Blogs > Ajax Workflow

Ajax Workflow


AJAX Ajaxform  Ajax.net 
Ratings:
0 Comment(s)
 772  View(s)
Rate this:

Ajax Workflow

Hi everyone in this blog I’m explaining about Ajax workflow.

Introduction:

With traditional approach HTML and JavaScript, to get some data from the server. It was necessary to make a form submission. With each submission the entire form was being reloaded. So it was loading an entirely new page and that was making performance slow but in case of Ajax this is possible from XHR.

In 2003, all the major browsers adopted the XMLHttpRequest (XHR) object that allowed browsers to communicate with the server directly without a page reload. 

The JavaScript object “XMLHttpRequest” is actually part of AJAX technology. Using the XMLHttpRequest API, JavaScript can directly interact with the server. The user can make a request to the server with a HTTP Get Response from the server and modify the required portion only (without a form submission/reload). But, various browsers implement it differently. For example Internet Explorer uses an ActiveXObject whereas other modern browsers use the built-in “XMLHttpRequest” JavaScript object.

So it's an overhead for developers to make implementation of XMLHttpRequest universal.

How it works?

  1. When the user creates an event (for instance, clicking on a button) on the specific component on the page, its logic implemented by JavaScript will create a request object (event message) represented by JSON formatted text, this process activates an AJAX Callback for the service response and calls the magicXmlHttpRequest object to dispatch a request to the specific endpoint.
  2. On the server side, we have a WCF service endpoint enabled for AJAX/JSON communications. The incoming message, after its JSON deserializing is forwarded to the workflow instance queue based on the Interface contract. Note, all layers are also configured by the knowledge base.
  3. The response from the service is received in the AJAX callback handler in a non-blocking process.

4.       Hosting and plumbing WCF and WF models is very smoothly implemented in the .NET Framework 3.5 (beta version). There are two additional context driven workflow activities for Send and Receive messages based on the Interface contract.

Advantages of AJAX based application:

1.       Improved application performance by reducing the amount of data downloaded from the server

2.       Rich, responsive and Slick UI with no page flickers

3.       Eliminates frequent page refresh which usually happens in a typical request/response model (Everything is updated on fly)

4.       Easy to implement as there are variety of AJAX implementations available around

5.       AJAX mechanism works behind the scene nothing much required from user perspective

6.       Works with all browsers

7.       Avoids the round trips to the server

8.       Rendering of webpage faster

9.       Decreases the consumption of server resources

10.   Response time of application is very faster

11.   Rendering of data is dynamic

So let us start with the basic concepts of Ajax Extension which comes with the ASP.Net Framework.

Using Ajax Extension

The following are the most commonly used Ajax controls in an ASP.Net Application which comes with the ASP.Net Framework and available under the Ajax Extension tab of ASP.Net Toolbox present at the left hand side of Microsoft Visual Studio framework.

These controls are:

1.       ScriptManager

2.       UpDatePanel

3.       Timer

4.       UpdateProgress

5.       ScriptManagerProxy

6.       Pointer

  1. Using ScriptManager

    When we use any Ajax control then there is a requirement to use the ScriptManager to handle the Scripting on the client side; without the ScriptManager Ajax controls are not run. So it's a requirement to use the ScriptManager.
     
  2. Using UpDatePanel

    Update panel is one of the most commonly used Ajax controls which is responsible for updating the particular requested content of the page instead of the entire page which is not requested. The ASP.Net controls are put under the update panel to make the benefit of this control. The ASP.Net controls which are kept under the update panel will be updated when the user clicks on a particular ASP.Net Control which are used in an application.
    You can use multiple update panels on a single web page.

     
  3. Using Timer

    The Timer is also one of the important controls; by using it we can update the particular content of the page automatically without clicking the browser refresh button. The Timer control is used along with the Update Panel so the Contents put under the update panel are automatically updated according the timing set under the timer_click event.
     
  4. Using Update Progress

    This control is used to notify the user to wait until the requests are processed on the server. Update progress control is used when the user clicks on any tab or control of an application. At that time the progress bar is shown which is the interval between the times taken by the server to process the client request.
     
  5. Using ScriptManagerProxy

    When you need to reference a service from your content page and yet the ScriptManager resides on the Master Page use a ScriptManagerProxy. The ScriptManagerProxy works by detecting the main ScriptManager on your page at runtime and hooking itself to that ScriptManager, making sure that any references given to it are also given to the real ScriptManager.

in my next post i'll explain about Post data With Ajax and ASP.NET MVC


Don't want to miss updates? Please click the below button!

Follow MindStick