Tuesday, January 16, 2007

TextBox Web Control Readonly Problem ASP.NET 2.0

We noticed a problem today at work where we have readonly text fields that can only be updated by using a calendar as end users have problems entering a date in a correct format.

We had achieved this in asp.net 1.1 by setting the readonly property to true of a textbox web control.

We discovered that none of our calendars were working. Ahhhhh :-(. Fingers started at pointing at the move from asp.net 1.1 to 2.0. In fact it was. asp.net 2.0 has changed the implementation of the textbox web control, if you set the readonly property to true it now stops the controls value to ever be updated.

We have worked around the problem by using a html input control rather than adding code to add the readonly attribute.

Friday, January 12, 2007

Publish Website using Visual Studio.NET 2005 Not Working (Error / Problem ahhh)

We noticed today that when we publish the web site project the folder that should contain the output is blank. Visual Studio.NET 2005 was reporting the build and publish had suceeded. So what was going on, well I did not know and was pulling my hair out till I found Dustys Blog article which saved the day

I can not believe that when visual studio.net 2005 finds an error in an aspx page when buidling it decides to stop building and displays a message stating the build suceeded. This sucks man. Thanks Dusty :-).

Tuesday, January 9, 2007

Adding an ASP.NET web site project to source control

After sucessfully migrating our web application from asp.net 1.1 to 2.0 and it actually building it was time to add it back to source control (visual source safe) and into a different visual source safe database to safely seperate the migrated asp.net 2.0 version from the asp.net 1.1 version.

Now this should have been as simple as 123. But again it was not to be easy as it should have been.

We selected the web site project in visual studio.net 2005 and right clicked and selected add project to source control and choose to add it to a visual source safe project within the the new visual source safe database. The web site project soon started checking in. This should have been the end of the story.....

Once all the files had been checked in we attempted to setup the web site project on a developers computer. We selected the option source control --> open from source control and selected the relevant visuals source safe project from the new visual source safe database. We were presented with an error message detailing that the visual source safe project did not contain any solution or project but if we were trying to open a web site project to press the help button. We press the help button and get a help topic documenting that the help topic we were looking for can not be found. Flipping great. Thinking it could be a problem with that developers installation of msdn we repeat the process on another developers computer. The same problem happens again. This is extremely bad news, the 1st time you really really want to read some help topic it can not be found (nooooooooooooo).

We looked in the visual source safe project and there was no solution or project file so we started looking at ways of adding one as we thought we may need one.

We could not work out how to add the solution file to source control as this is what seemed to be missing as there should not be a project file anymore (thank god that made mutli user development / branching a pain). Eventually a developer found a setting in visual studio.net 2005 which you had to tick to display the solution in the server explorer so that it could be checked into the visual source safe project (tools --> options --> projects and solutions --> always show solution).

At last we thought we had the answer. We recreated the web site project in visual source safe but when we tried to check the web site project out to two developers computers it would put the web site project into the my documents (/visual studio 2005 / projects) location rather than the webroot.

Still no closer to the solution and about 1/2 day had passed.

Eventually we find an article on google which advises us that we must use the option open website and then select from source control. At last we had worked out what we needed to do as well as recreating the web site project in visual source safe again.

I guess the help topic that we would could not locate would have told us that.

Warnings in Visual Studio.NET 2005

When building a web site project in visual studio.net 2005 you will recieve warnings about code that contains common coding errors such as defining a variable and not using it. Now this is a good feature of visual studio.net 2005 but after painfully migrating our web application from asp.net 1.1 to 2.0 and getting it to build, removing any warnings were not at the top of out priority list. It would be good if these warnings would go away.

I had migrated a command line utility a few days before from version 1.1 to 2.0 of the .net framework and noticed the ability to turn off of which warnings you did not want to be warned about.

Now if only I could find where I configure this I would be laughing. This was not to be though as I soon relised this amazing functionality was not available to asp.net 2.0 web site projects. How pants is that :-(

Building a recently migrated ASP.NET web application for the 1st time

We had recently managed to migrate our web application from asp.net 1.1 to 2.0 using the migration wizard contained in visual studio.net 2005.

When we built the web application or should we now say web site project now it has been migrated we were presented with the 50 or so errors that were detailed in the report produced by the migration wizard. At this point we though wow that should take a few hours to fix and then we are home and dry.

We fixed the 50 errors which were all because pages / user controls (part of a 3rd party component) had codebehind declarations to files that did not exist.

We crossed our fingers and then built the web site project for the second time. Damn it more errors. We fixed these errors and then built the web site project for the third time. Damn it even more errors.

At this point we were loosing faith in visual studio.net 2005 as when we built the web site project we expected to get a definite list of all errors. This is a necessity as we need to budget how much time it is going to take to resolve any errors that exist.

After a futher ten fixes and rebuilds the web site project sucessfully built. yeah :-).

Migrating to ASP.NET 2.0 and Visual Studio .NET 2005

The time eventually arrived at work when we had to upgrade an asp.net web application from asp.net 1.1 to asp.net 2.0 and embrace visual studio.net 2005.

We started by retrieving the latest version of the web application using visual studio.net 2003 which was under source control (visual source safe 6).

As a safety precaution all access to the visual source safe project containing the web application was revoked to stop any part of the migration wizard modifying the asp.net 1.1 version of the web application.

The latest version of the web application was copied to a different machine where the migration wizard was started by openning the solution using visual studio.net 2005. Unfortunately the wizard did not make much progress as it tried to communicate with visual source safe to remove the source control bindings which is part of the migration wizard. It failed to do this as we had revoked access. We manually edited the solution file to get round this problem.

The migration wizard ran for some time before presenting us with a report about the status of the migration. A number of errors existed in the report because certain pages / user controls had codebehind declarations to files which did not exist.

Looking through the migrated web application it had created a stub class file for every page which seems a but uneccessary, moved all the class files to the app_code folder, adding a namespace declaration to each existing class file, adding references to the web.config and a few other things.