How to Develop a One-Page Web Application - How to work with the Visual Studio IDE
(Page 2 of 4 )
When you start a new web site, ASP.NET provides the starting folders and files for the site, including two files for the first web form of the site. The file named Default.aspx contains the HTML and asp code that defines the form, and the file named Default.aspx.vb contains the Visual Basic code that determines how the form works. Then, Visual Studio displays the aspx file for the web form as shown in figure 2-2.
If you’ve used Visual Studio for building Windows applications, you should already be familiar with the Toolbox, Solution Explorer, and Properties window, as well as the Standard toolbar. They work much the same for web applications as they do for Windows applications. The Solution Explorer, for example, shows the folders and files of the web site. In this example, the Solution Explorer shows one folder named App_Data, plus the two files for the default web form.
To design a web form, you use the Web Forms Designer that’s in the center of this Integrated Development Environment (IDE). When you start a new web site, this Designer is displayed in Source view, which shows the starting HTML code for the first (or only) web form of the application. Normally, though, you’ll do most of the design in Design view, which you can switch to by clicking on the Design button at the bottom of the Designer window.
If you have your environment settings set to Web Developer, you’ll notice that different toolbars are displayed depending on what view you’re working in. In Source view, the Standard and HTML Source Editing toolbars are displayed. In Design view, the Standard and Formatting toolbars are displayed. This is typical of the way the Visual Studio IDE works. By the way, to change the environment settings, you use the Tools->Import and Export Settings command.
As you go through the various phases of building a web site, you may want to close, hide, or size the windows that are displayed. You’ll see some examples of this as you progress through this chapter, and this figure presents several techniques that you can use for working with the windows.
After you’ve designed a web form, you’ll need to switch to the Code Editor, which replaces the Web Forms Designer in the center of the screen. Then, you can write the Visual Basic code in the code-behind file for the form. One way to switch to the Code Editor is to double-click on the code-behind file in the Solution Explorer. If, for example, you double-click on the file named Default.aspx.vb, you’ll switch to the Code Editor and the starting code for that file will be displayed. Later in this chapter, you’ll learn other ways to switch between the Web Forms Designer and the Code Editor.
As you work with Visual Studio, you’ll see that it commonly provides several ways to do the same task. Some, of course, are more efficient than others, and we’ll try to show you the best techniques as you progress through this book. Often, though, how you work is a matter of personal preference, so we encourage you to review and experiment with the toolbar buttons, the buttons at the top of the Solution Explorer, the tabs at the top of the Web Forms Designer or Code Editor, the shortcut menus that you get by right-clicking on an object, and so on.
The starting screen for a new web site

Figure 2-2. How to work with the Visual Studio IDE
How to work with views and windows
- To change the Web Forms Designer from one view to another, click on the Design or Source button.
- To close a window, click on the close button in the upper right corner. To redisplay it, select it from the View menu.
- To hide a window, click on its Auto Hide button. Then, the window is displayed as a tab at the side of the screen, and you can display it by moving the mouse pointer over the tab. To restore the window, display it and click on the Auto Hide button again.
- To size a window, place the mouse pointer over one of its boundaries and drag it.
Description
- When you start a new web site, the primary window in the Visual Studio IDE is the Web Forms Designer window, or just Web Forms Designer. The three supporting windows are the Toolbox, the Solution Explorer, and the Properties window.
- You use the Web Forms Designer to design a web form. Later, to write the Visual Basic code for the form, you use the Code Editor as shown in figure 2-14.
- Visual Studio often provides several different ways to accomplish the same task. In this book, we’ll try to show you the techniques that work the best.
Next: How to add folders and files to a web site >>
More ASP.NET Articles
More By Murach Publishing
|
This article is excerpted from the book Murach's ASP.NET 2.0 Web Programming with VB2005, written by Doug Lowe (Murach, 2006; ISBN: 1890774324). Check it out today at your favorite bookstore. Buy this book now.
|
|