Creating an Album List with Ajax and C#

Written By: Jay

- 20 Jun 2006 -

Description: Over the past few months I have been toying with Ajax and .NET via the AJAX.NET Pro Library. I recently had a specific task to complete and it seemed to be a perfect candidate for Ajax. The task was very simple, get a list of Albums by an Artist. This functionality is of course part of a much larger on-line music app I was constructing but I needed to start with something small. The UI was very simple a TextBox to enter an Artists' Name and a Table to display the Albums.

  1. Objects and Data
  2. Diving In
  3. Ajax and the UI
  4. The Next Level
  5. Conclusion and Pitfalls

Conclusion:

And that's it. Now when you search form an artist by name you will get back a list of Albums all with-out the need of a post-back!!

To extend this application the next step would be to select an Album and bring back a list of songs. Once you've got the song list you could furthur extend this by selecting a song and open it with winamp.

Pitfalls:

  1. Add the HTTPHandler to the web.config.
  2. The Search methods in the code behind must be public.
  3. The Search methods in the code behind must have [Ajax.AjaxMethod()] attribute.
  4. Check the web control id names. In you use this as a web control .NET adds _Ctl0 to the ID's

If you run into problems try running the application using the traditional Post-Back method to be sure that everything is working.

<< Previous