AJAX web app using ATLAS & VS.NET 2005

Posted by: Clarity Blogs: ASP.NET, on 05 Oct 2005 | View original | Bookmarked: 0 time(s)

Every time I start to passively browse Microsoft's MSDN site, I can't help but come away with some emerging technology that I can't wait to get home and hammer at.  Hmm, the fiancee's working, the dog is sleeping....let's do this.  Tonight's episode: ASP.NET's Hands On Lab featuring Atlas

"Atlas" is the codename for ASP.NET adding support for Asynchronous JavaScript and XML (AJAX).  The beauty of AJAX is the ability for client-side browsers to call a web service asynchronously to render content to the page without requiring the page to re-post.  This method has been used by large websites, but was cumbersome and required a lot of code to maintain.  ASP.NET implements the Atlas template to allow a developer to have a simple AJAX enabled website up in less than 30 minutes.  Here's an overview of how to pull this off: 

(Note:  installing the Atlas template and creating a new website will open the lab's step-by-step instructions, so I won't rehash the details here)

The Basics: 

Prerequisites: Beta 2 or an RTM installation of Microsoft Visual Studio 2005 and the .NET Framework version 2.0.

1) Install the ASP.NET Atlas template (download it here).

2) Create a new website, and select the Atlas Template
New ASP.NET Website

3) Add a New Item to the project, and select "Master Page".
Add the Master Page

4) The Master Page holds the core setup of the AJAX process, setting the required scripts and formatting child pages.  This form is not required for AJAX, but for simplicity the lab recommends using it.  You'll modify the DocType of this form, and the asp:contentplaceholder control to allow for dynamic content.  Notice the scripts being set to handle different browsers.  These scripts play an important role in this project, as they allow the client browser to contact the web service.  Modify the source to look like Microsoft's example:
Master Page Source

5) Now you need a web service to handle requests and generate content for the client browser. Add a new web service to the project.
Add a Web Service

6) Modify the source as follows; the web service has one WebMethod that accepts input and retuns a value. This method is the same as any other .NET web service, and can access local services, databases, file stores, or other assemblies.
Web Service Source

7) Right-click on your Master Page, and select "Add Content Page" to create a child form.  This form will contain your form and AJAX content.  You'll add a method to submit the user's query to the web service, and a callback method the web service will use to notify the form that a response is ready.  This is an asynchronous call, remember, so the callback is necessary to alert the form its time to go.
Content Page Source

8) You're all set!  Save and build your project, then right click on the content form in Solution Explorer, and select 'View in Browser'.  You'll see your initial form, and entering text and submitting the form results in new content rendering to the page, without having to repost itself.
View in Browser

Like I said, Microsoft's lab does a good job of explaining why you are adding specific code to the forms.  Give this lab a half hour, and you'll be amazed how easy AJAX implentation is using Visual Studio.NET 2005!

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Ajax | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 3014 | Hits: 31

Similar Posts

  • MSDN Guidance on ASP.NET MVC vs WebForms and its Impact on my EF + ASP.NET Work more
  • ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities more
  • Welcome the WebUI Test Studio v2.0! more
  • Introducing Recurring Appointments for Web.UI Scheduler ASP.NET AJAX more
  • Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 17 more
  • RadScheduler for WinForms data binding and occurrence exceptions more
  • Update Out Of Browser (OOB) Silverlight apps more
  • Silverlight From Zero more
  • Sneak Peak: CSS Sprites Make Your Websites Faster more
  • ASP.NET 4 Web Server Here Shell Extension more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD