CODECUBE VENTURES

Working with VS.NET and DW MX

I just finished redesigning the Orlando .NET User Group's web site and I learned just what makes code behind valuable.

Since the code is contained in one location, you can have multiple UI pages (.aspx) that "inherit" from the same code file. This makes redesigning a page real easy because all you have to do is make sure you include the web form and all user controls on your page, and the correct Inherits attribute in the @page directive.

Here's what part of the old VS.NET Generated page looks like:


<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false"
Inherits="ONETUG.Web._Default" %>
<%@ Register TagPrefix="uc1" TagName="top" Src="/controls/top.ascx"%>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="/controls/Menu.ascx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Orlando .NET User Group</title>
<meta name="GENERATOR" content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

Visual Studio (interdev, frontpage) doesn't have a great track record with design tools, and since the new page was generated with Dreamweaver MX, making it XHTML compliant was a snap ... it doesn't insert all of this extra fluff meta tags like VS.NET. Here's what part of the new page looks like:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1"
AutoEventWireup="false" Inherits="ONETUG.Web._Default" %>
<%@ Register TagPrefix="onetug" TagName="menu" Src="/controls/menu2.ascx"%>
<%@ Register TagPrefix="onetug" TagName="sponsors" Src="/controls/sponsors2.ascx"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Orlando .NET User Group</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/styles/onetug.css" type="text/css" rel="stylesheet" />

Notice the cleaner, XHTML code? that's the way a web document should start out.

All in all, I think the new design turned out better than the old.

What do you think?

Latest post: Digging Up the First Version of CodeCube

See more in the archives