Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ASP .NET 2.0 Beta Preview - B. Evjen.pdf
Скачиваний:
26
Добавлен:
24.05.2014
Размер:
15.33 Mб
Скачать

Chapter 2

Figure 2-16

Lost Windows

You may not be able to find some familiar windows in the Visual Studio 2005 release. For instance, when you open one of your ASP.NET applications in Visual Studio 2005, you do not see the Class View and Dynamic Help windows. Although not apparent in the default view when the IDE first opens, these windows are still available for use with your applications.

You can find the Class View by choosing View Other Windows Class View from the Visual Studio menu. The Class View window opens directly next to the Server Explorer. You can move the window wherever you want within the IDE.

You can find the Dynamic Help window by choosing Help Dynamic Help. Selecting this option opens the Dynamic Help window next to the Properties Window.

Other Common Visual Studio Activities

Visual Studio 2005 is so packed with functionality that it deserves a book of its own. This IDE is mammoth and enables you to do almost anything in the construction and management of your ASP.NET applications. This section takes a look at some of the common tasks that are done somewhat differently or in an altogether new manner in this latest release of Visual Studio.

34

Visual Studio 2005

Creating new projects

The process of creating new files and projects within Visual Studio 2005 is different than it was in Visual Studio 2002 or 2003. In this latest release of Visual Studio, the focus on project-based applications is gone. Now projects are created in a page-based manner. This means that when you create an ASP.NET application in Visual Studio, you don’t find solution or project files. In fact, when you first create the application, the only items created for you by the IDE include the project folder and a single .aspx file. If you are creating an ASP.NET page using the code-behind model, you also have an .aspx.vb or

.aspx.cs file.

One of the big changes you notice when opening the IDE is that no Start Page appears. You are presented with a blank IDE. You can create either a new single .aspx page or a Web site. To create a single page, simply go to the menu and choose File New File. To work on a previous file, choose File Open File. To create a new ASP.NET application, choose File New Web Site. You can see the dialog of options in Figure 2-17.

Figure 2-17

In most cases, you select the first option — ASP.NET Web Site. This creates a single folder for your application and a default .aspx page.

Making references to other objects

When you look at the Solution Explorer of your ASP.NET application, notice that the References and Web References folders are not present. How do you add these references to your file-based applications?

You can add them in a couple of ways, and both ways bring you to the same dialog within the IDE. The first way of adding references to your application is to highlight the solution in the Solution Explorer and then choose Web Site References from the Visual Studio menu. The second option is to right-click the solution in the Solution Explorer and select Property Pages from the list of options. Both methods bring up the Property Pages dialog shown in Figure 2-18.

35

Chapter 2

Figure 2-18

The Property Pages dialog allows you to make many modifications to your ASP.NET applications. For now, however, focus only on the first tab within the dialog — the References tab. When you have the References tab open, two enabled buttons appear at the bottom of the dialog — Add Reference and Add Web Reference.

The Add Reference button invokes the Add Reference dialog so that you can make a reference to a DLL to use in your project. Again in this version of Visual Studio, the objects are divided into categories such as .NET, COM, and others, as shown in Figure 2-19.

Figure 2-19

36

Visual Studio 2005

The Add Web References button invokes the Add Web Reference dialog (shown in Figure 2-20). Here you can make references to other Web services or .wsdl files found either in the same solution, on the same server, or on some remote server.

Figure 2-20

Be aware that these buttons have been added because no References or Web References folder appears in the Solution Explorer, which shows the referenced objects.

Using smart tags

The visual designer of Visual Studio now includes smart tags. Smart tags are a great enhancement to the development experience because they enable you to quickly program common tasks. Each smart tag is different and depends on the server control that it works with. For instance, the smart tag that appears for the GridView server control enables you to quickly apply paging and sorting of the data that the GridView displays. Other controls, however, may have different capabilities exposed through their respective smart tags.

Not every server control has a smart tag associated with it. If a server control does have this extra capability, you notice it after you drag and drop the control onto the design surface. After it is on the design surface, an arrow appears in the upper-right-hand corner of the control if a smart tag exists for that particular control. Clicking the arrow opens up the smart tag and all the options that the smart tag contains. This is illustrated in the GridView server control shown in Figure 2-21.

From the smart tag, you can select items either to add or alter by clicking one of the available links or by checking one of the available check boxes. When you have completed either of these actions, Visual Studio changes the code in the background — adding the capabilities that you want. You can also see the additions and modifications to the IDE if you change your view to the Code view of the page.

37