Editing the Default Page
4 Feb 2008 @ 02:02PM

Updated: 22 Jan 2010 @ 02:03PM
After creating your first website as detailed in the last page, Visual Web Developer automatically opens the Default.aspx page. Default.aspx is the equivalent of index.php in the PHP world... it's the page that's automatically loaded if no specific page is specified. For instance, you could navigate to you'll be pulling up this web page. There's not really much going on yet. Let's take a moment to quickly go over the Visual Studio GUI. An example of the GUI is pictured below:

The Visual Studio GUI

Along the top of the page you'll see the regular assortment of menus and toolbars. Feel free to poke around in them, though most of it probably won't mean much. As we use portions of it you'll become more familiar with the layout. On the left side you'll see a bar with Toolbox, CSS Properties and Manage Styles options. The toolbox contains prebuilt items, like listboxes and such. The other two are for CSS styling. As mentioned in the introduction, I prefer to write the code myself so I never use these options.

On the right side of the screen you'll see a solution explorer at the top. This shows all the files currently in your web application. If a file isn't already open (or we've closed it) this is how to access it. On the bottom right is the Properties dialog. I don't ever use this either.

Finally you'll see the center tabbed section. This is the actual page code. You can have multiple pages open at the same time. In this case I have Default.aspx and the Start Page open. You'll notice that Default.aspx looks alot like HTML (it is) with a few extra things. The first is the first line which reads:

The First Line of Code

This is the page directive and tells .Net what to do with it. The <% is the opening of a code block. In PHP code is opened with
The only other non-HTML items in here are the properties of runat="server". This tells the server that this portion of the HTML should be parsed by the server prior to being served to the client. What that means to us is that we can interact with portions of the HTML that have runat="server" in them.

With the basics out of the way, let's write some code.
Comments (0)