Showing posts with label Windows Forms. Show all posts
Showing posts with label Windows Forms. Show all posts

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

24 March, 2011

Force termination of Apps; unable to load installer (.vdproj) file in .NET IDE

Image representing Microsoft Silverlight as de...Image via CrunchBaseI encountered some problems with my applications today, and searched the web for help.

> I saw one article (I quickly closed, so I am unable to reference it here) that instructed the single-line code:

Application.Exit()
Environment.Exit(0)

Application.Exit() is used when you are running a WinForms app.
Environment.Exit() is used when you are running a Console app.

If you need the values to be supplied with the method call, these are below, by standard:

0 - Success
1 - InvalidLogin
2 - InvalidFilename
10 - UnknownError


-----

The other problem I encountered on one development machine, not just today, but a few days back, and also today, is the problem of the .NET IDE not loading the installer project. And this only happens in one machine. All the rest are okay.

What came up in my web search are a couple of suggestions, solutions by users having the same problem:

> Run a registry cleaner, like CCleaner. And this is especially if you have done uninstallation of softwares, especially similar products recently.
> The steps below, taken from a forum's article, :

1. Make sure that Visual Studio user project/item templates location is right. (Menu: Tools > Options > Projects and Solutions)
Default path for VS2005 for projects is: %UserProfile%\My Documents\Visual Studio 2005\Templates\ProjectTemplates
Default path for VS2005 for items is: %UserProfile%\My Documents\Visual Studio 2005\Templates\ItemTemplates
*%UserProfile% refers to C:\Documents and Settings\

2. Run devenv.exe /ResetSkipPkgs (Clears all options to skip loading added to VSPackages by users wishing to avoid loading problem VSPackages, then starts Visual Studio.)

3. Use devenv.exe /setup to restore the VS settings to their original state. If you have, for instance, packages that failed to load and you clicked the button to disable them from loading in the future, you can get them back again with the /setup switch. The original problem that caused the package to fail to load may or may not have been corrected so you may need to correct that before all packages load correctly.
This is similar to /ResetSkipPkgs, but also gets newly installed packages resource info completely registered.

4. Run devenv.exe /ResetSettings to isolate the settings problem

5. Visual Studio uses a cache on disk of all the installed project/item templates, to rebuild the cache, please run devenv.exe /InstallVSTemplates (in Start > Run or "Visual Studio 2005 Command Prompt")



-----

I have applied the single-line code to my affected application, and to the others that are okay, in case they do. I have cleaned the registry using CCleaner. It didn't work.

I have also followed all the steps above, from 1 to 5, and the problem persists.

I have now performed reinstallation of VS2005.


> After some time, I find that this has not been how I expected to be fixing this problem. I thought it was easy. My VS2005 reinstallation encountered some error. I remember manually uninstallating a lot of those MS softwares, like Silverlight, RIA toolkits, Expression Blend, etc., etc. I may have removed some critical softwares...

I am reinstalling those MS softwares that I know are critical, and I'm keeping my fingers crossed...

Till then!



Enhanced by Zemanta

22 February, 2011

String to StringBuilder, AJAX, Silverlight

.Net Framework LogoImage via WikipediaAfter a week-long course on 2957B and 6463A, I found some new ways to make my applications run faster and sleeker (performance- and graphics-wise).

I know, these are not new, but I didn't know better before.

  • String to StringBuilder
  • Double buffering
  • AJAX
  • Silverlight

Silverlight 4 UnleashedString to StringBuilder

Especially when manipulating strings, 2 - 3 times at most, the String var type is still OK. More than that, you should be considering the use of StringBuilder.

One of the problems that I encountered with StringBuilder is the clearing or blanking off of the var. Then I found out that in .NET Framework 4.0, the Clear() method is already available. In 3.5 or lower, you can set the Length = 0, which effectively resets the char length.

The StringBuilder also has Append() and Appendline() methods, which effectively obsoletes the equivalent coding for String, like "& vbCrLf", etc.


Double buffering

A very simple functionality, but like I said, I didn't know better. So my Windows forms are now flicker-free.


AJAX and PHP: Building Modern Web Applications 2nd EditionAJAX

Now this is new. I am yet to implement this, because Web forms are a transition for me, at least I know that there is a technology that is available to my use - for a better experience of my users, performance-wise!


Silverlight

Adding to AJAX, Silverlight is another trick up my sleeve. Well, this is on the graphics side of webpages, so that they are more pleasing and more attractive.


Foundation Expression Blend 4 with SilverlightAnd these are some of the big things that I have 'learned' in my week-long course, so hopefully, I now will be a better software developer.

Till then.

Enhanced by Zemanta