07 August, 2011

ASP.NET AJAX in VS2005

Cover of "Foundations of ASP.NET AJAX (Ex...Cover via Amazon07-August-2011

I was given a project at work that involves, writing web pages, instead of the usual Windows Forms (GUI) and console applications. Thus began the bumpy journey into learning ways and means of building web applications – from scratch.

Well, at least that is the level that I am starting off – from the ground.

I had my short course taken on advanced windows programming, and ASP.NET 3.5 within a week. I learned a couple of things that were fundamental to developing robust windows applications, and using the appropriate classes and methodologies. And when I came back to work, I have to undo a lot of those bricks that I have laid down wrongly. It was quite a very taxing job, as I have to keep the codes running while the cleaning is on-going.

I’m still not done.

And i have to begin a new project, completely different from what I have been doing for the past 10 years.

Actually, I created a very simple web application in the past years before, and it is running, and so simple was it that when it ran, I left it as it was, and forgot all about that I ever did when I built it from scratch.

And I have to go back and learn ASP.NET once again, and this time, the project is quite of a size that I have to learn correctly, and I have to learn fast.

Setting many stories aside, after the short courses, I am pretty sure that I didn’t become an expert – immediately. I had to do a lot of coding, since a lot of these hands-on is to make sure that I understand what I have learned and to help me retain the skill, which I am sure ill get enhanced as my skill level goes from one notch to the next level up.

After a lot of books were borrowed from the library, I finally got one that helped me leverage those head knowledge that I got from reading Bulletproof Ajax, and the counterpart Codin’ for the Web, etc. I learned straightforward HTML and CSS from W3 School’s books, which were mostly a compilation of their online lessons.

Before the book I am holding now, I actually found Scott Guthrie’s tutorial on building web pages, for while the tutorial is short, the learning is tremendous. Thanks, ScottGu for all the good work you are doing for the rest of all the other programmers around the globe.

The book I found to be discussing in the same frequency as my learning style is Foundations of ASP.NET AJAX by Robin Pars, Laurence Moroney and John Grieb. This is accompanied with examples which is downloadable from Apress.com.

Having said that, I should be on my way to a continuous and enjoyable and fruitful learning, right?

Not quite.

I am using both VS2010, and VS2005.

Now I am one who is quite eager to make full use of VS2010, since there is so much that this IDE has to offer, compared to VS2005. But then again, things don’t quite run well (maybe not yet) in VS2010, and this problem forced me to go back to using VS2005. I am still using VS2005, but I am slowly and steadily migrating my codes all to VS2010. So I’m doing this in parallel.

Now, between VS2005 and VS2010, aside from the differences in the IDEs themselves, things should be quite the same, isn’t it?

Not quite, for the second time.

Remember that I am learning ASP.NET AJAX.

The problem is that in VS2005, AJAX extensions and toolkit isn’t an integrated part of the IDE, which means a separate installation has to be made.

The AJAX Control Toolkit comes from a download binary file, or the full source code is available, from www.codeplex.com, which is also linked to the download page if you go to the official ASP.NET website www.asp.net/ajax.

Actually, if you look at the methods offered in the many pages found in the web, it is very simple and straightforward. But then again, is your problem solved right away?

Not quite, for the third time.

Let me cut to the chase, and share what I have learned.

For VS2010, it was straightforward. AJAX Extensions was already in the toolbox, and adding the AJAX Control Toolkit was as simple as downloading from www.codeplex.com the version that was suited for it (toolkit v4.)

As for VS2005, this is a completely different matter altogether.

How do I begin to tell you my small adventure?

Well, I assumed things would be the same, so searching for the toolkit set for VS2005 in www.codeplex.com, I was pointed to release 20229. And instruction was to just download the NOSOURCE version if you have no intention whatsoever of extending the toolkit.

That I did, but I got an error that baffled me:

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral…

I wrestled with this error message. Some articles in the web pointed to using the AJAX toolkit with the source code, which is actually a solution with 4 projects, and open that in VS2005, do a full build, and use the toolkit dll file found in SampleWebsite\Bin directory.

That I did, and was the problem solved? Nah!

I did quite a lot of searching… until…

I found that VS2005 SP1 must be installed before adding in the AJAX toolkit. So I searched for VS2005 SP1, installed it after checking whether it is already installed or not, and to make sure, I installed it over the currently installed SP1. Then I added in the AJAX toolkit by the NOSOURCE toolkit dll file. Still no success.

Actually, I tried to use the toolkit solution, but I can’t build the projects because it is looking for the Web.Extensions 1.0.61025.0 version, which is still missing.

Finally, what led me to the solution that fixed my problem is the result set I got when I searched through Google the following string: “System.Web.Extension 1.0.61025.0 error” – through this I found that I should have installed ASP.NET AJAX 2 Extensions 1. Afterwards, the adding of AJAX Control Toolkit tab is a natural.

SUMMARY:

If you are intent in having the AJAX tabs (extension and toolkit) in your VS2005 toolbox, here are the things that you should have and do, in sequence of operation/importance:

  1. Make sure that you have VS2005 SP1 installed.
  2. Install ASP.NET AJAX 2 Extensions.
  3. Download AJAX Control Toolkit (FULL, or NOSOURCE) Version 1.0.20229 from www.codeplex.com.
  4. Add in the Toolkit items using AjaxControlToolkit.dll from either the Full or NOSOURCE version (SampleWebSite\Bin folder, whichever folder you saved it).
  5. If you want the extender, build the AJAX Toolkit solution Template project, and make sure it has no errors and build completely, then click/double-click on AjaxControlExtender.msi (found in AjaxControlToolkit\TemplateVSI\bin folder).

Happy AJAXing!

Enhanced by Zemanta