Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts

Monday, May 19, 2008

AJAX.Net

In the past I have talked about some of the frameworks being used on the current website I am working on uses. I have mostly talked about NHibernate. Well this post will be different since I am going to talk about a UI Framework called AJAX.Net and the AJAX Tool Kit. These frameworks come from Microsoft.

On our website we use the UpdatePanel quite a bit. It provides a simple async call back mechanism so we only have to post back parts of pages. This comes in handy when u want to update a part of a web page with new information or data without having to interrupt the user from reading or investigation other parts of the web page. The control is very easy to use and can really save developers lots of times in implementing this type of functionality.

I could talk all day about the update panel, but I want to really talk about a control found in the AJAX toolkit called ModalPopupExtender. We use the ModalPopupExtender control on our project to notify the customer that then still have work to do in filling out their data. Since user input is gathered in multiple steps it guides the user to what they need to do next. Of course we give the user the option to close out of it and move forward on their own. We added data checking so that the modal pop ups only display when needed.



As you can see the background get grayed out and you can style the pop up to look like the rest of your website. You can put any HTML, ASP.NET control, or other control in the modal.

If you haven't already checked out the AJAX.NET or AJAX toolkit from microsoft, you can fin them here.

Friday, December 01, 2006

AJAX

So at work we have these meetings once in a while where we discuss technology. Well it was my turn to lead a discussion and I thought AJAX would be a good topic.

At a past client, I used AJAX for a on the fly rate form. Basically how it worked was when a user filled in a field, the updated line item and grand total was to be updated without a full page post back. Well when I did this project ATLAS, now AJAX.ASP.NET was not ready, so I had to do it the old school way.

So first before I go further let me talk about what AJAX is. AJAX, stands for asynchronous JavaScript and XML. AJAX is a web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page's interactivity, speed, and usability.

Some pros of using AJAX is bandwidth usage, and interactivity. With smaller request to the server, smaller amounts of data or subsets are transmitted. Some cons, are latency and usability. When part of a web page is being updated, some controls can become unusable.

So now that you know a little more about AJAX in general lets talk geek....

Basicly the guts of it all revolves around an object called XMLHttpRequest. This object will make a request to a url and collect the response from the request. the url could be anything, but web services work well. Then you can take the response usually and XML and manipulate it and set controls on the web page.

Now I find this a challenge since I am not a big fan of JavaScript and Microsoft Visual Studio does not give you great support for JavaScript. However I was still able to provide a good solution for my client, and I saw benefits to this technique.

Now lets fast forward to today. The people at AJAX.ASP.NET have release a beta of an AJAX framework. This framework wraps up the JavaScript and all you have to do is the ASP. Any regular asp control can be enabled to post back asynchronously. Also they released a toolkit extension that gives you additional support.

During our discussion one of the areas we decided we could really use this is in field validation. Validation is tough because a lot of times you need to duplicate your validation logic in JavaScript for the client side validation and then in you BLL for server validation. Using AJAX you can now validate fields as the user fills them out and keep you validation code only in your BLL.

As you can see, AJAX is a very useful tool. With the help of AJAX.ASP.Net (Atlas) you can really improve on the user experience at any website you have to build.