Print
Add To Favorites
Email To Friend
Rate This Article
|
One Minute Conversion of Web Forms to 2.0 "Whidbey"
|
Published:
06 Sep 2004
|
Abstract
This article describes the steps needed to convert a web form from ASP.NET 1.1 to ASP.NET 2.0 Codename "Whidbey." The process is simple and quick for those pages missed by the conversion tool. |
![](/images/photos/ceb78e0b-f8a8-4fb9-b689-43a278d01725_80_80.jpg) |
by Terry Voss
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
6790/
15
|
|
|
|
Recently, due to a Microsoft Ascend program, a client decided to convert their project to Visual Studio 2005 now versus waiting for a later upgrade version. They need advertising to get funding and to get more subscribers for their web site when the project is finished about summer 2005.
I am not trying to convince developers or anyone that Visual Studio 2005 is currently stable enough to convert to now! There are many more builds going to take place before the retail version is available. The ASP.NET Team is currently working to solve upgrade problems and make it seamless.
Actually, the auto-conversion worked on a smaller project but just wouldn't do this 1,000 file database project with 180 .aspx files. Also, what if your project converts, but later you find a particular .aspx file that didn't get converted? I could not find a way to tell the auto-converter to act just on that one file, so if there was an easy way to do this it would be great. I was able to use this method to convert the entire project (180 aspx pages) in one day.
Conversion Steps for VS 2005:
In the .aspx file:
1) Replace "Codebehind" with "CompileWith," which tells ASP.NET where to find its other half, if you're using the two-page, code-separation model.
2) Replace "Inherits" with "ClassName"; this tells ASP.NET what class name to use, so it matches with your partial class declaration in the code separation file.
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="adl.aspx.vb" Inherits="tic.adlpage" smartNavigation="False" %> becomes
<%@ Page Language="vb" AutoEventWireup="false" CompileWith="adl.aspx.vb" Classname="tic.adlpage" smartNavigation="False" %>
3) Delete any references to "positionlayout=gridlayout" in the body tag as it is no longer supported. Flow layout is the way to go now inside of panels.
4) If design view won't come up, fix all related errors. To do this use the Task List window's errors to look for the "Can't switch" errors and double-click them to get to the problem. You will find that basically they are all HTML tags illegally overlapping like <P><asp:panel></P> type, so they are easy to fix.
In the .aspx.vb code separation file (if you are using one):
1) Add your project namespace declaration if it is not already there around the partial page class. This is no longer part of the project properties or done automagically for you.
2) Replace "Public Class" with "Partial Class" and delete the Inherits statement. Since this class is now part of the class generated from the .aspx file (which will inherit from System.Web.UI.Page), it is not necessary to do so in our part.
Now also, if Microsoft makes any of their source classes partial, we can extend those classes versus just sub-classing them by using the same class name with partial and adding methods and properties.
Public Class testpage : Inherits System.Web.UI.Page becomes Partial Class testpage
3) Delete all control declarations in this class that are on the .aspx page. ASP.NET declares the controls in its auto-generated class parsed from the .aspx file. Since we're now using a partial class, we share the declaration in that file, instead of declaring it in our code separation class.
4) If there are no errors in the Task List pane, then you will have no problem saving and running with this conversion. If there are any errors showing up, you need to fix them. Understand that sometimes an error won't show as fixed in errors even though you have successfully fixed the error. So when compile errors show up, try continue YES versus the usual NO to see if it runs your start page.
You are done now with that page's conversion and yes one minute is easy on a simple page; complex ones take 2 minutes. :)
Good luck and send your questions to: tvoss@computer-consulting.com | |
|
|
User Comments
Title:
Desesperate person...
Name:
Paulo Gorenstein....
Date:
2004-10-02 6:01:57 PM
Comment:
All i could do until now...if you have a real tutorial with data conection examples please send me...paulogor@yahoo.com
|
|
Product Spotlight
|
|