Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with ASP.NET : Page 2

Learn what it takes to begin building ASP.NET Web sites with Visual Studio .NET. This article will provide you with the knowledge you need to jumpstart your foray into the world of ASP.NET development.


advertisement
Your First ASP.NET Project
Now you're ready to get your feet wet. Launch Visual Studio .NET and let's get started. To create a new ASP.NET project in the Visual Studio .NET IDE, select File | New | Project, and then select ASP.NET Web Application from the Templates. Name the project LearnASPNet (see Figure 1), click OK, and Visual Studio will build the project files. The Solution Explorer will contain your newly created project and a Web Form named Webform1.aspx (see Figure 2).

Figure 1: Create new projects in Visual Studio .NET using the New Project dialog box. There is a template for each type of .NET application.
Figure 2: The Solution Explorer contains all of the items referenced in the application.
The first thing to do is rename Webform1.aspx to MyFirstWebForm.aspx. Right-click on Webform1.aspx and select Rename. Then, right-click on MyFirstWebForm.aspx again and select Set As Start Page. This ensures that MyFirstWebForm.aspx will be the Web Form initially displayed when you run the project. Let's launch this Web Form just to make sure you configured your machine correctly. Click the blue triangle in the toolbar (see Figure 3), select Debug | Start, or press F5 to launch the form.

Figure 3: The Visual Studio .NET toolbar provides a convenient way to open and save projects, cut, copy, and paste elements, and run your projects.
If you set up your machine correctly you should see a blank Web page (see Figure 4). Congratulations, you've just created and run your first ASP.NET Web Form! Close the browser and return it to the Visual Studio .NET IDE.
Figure 4: Running the project also compiles the project and launches the browser loaded with the start page, <span class="pf">MyFirstWebForm.aspx</span>.
One of the first things to note about your newly-created Web page is the text in the middle regarding the layout mode of the page. There are two options for layout mode: GridLayout and FlowLayout. You specify the layout mode used by the page on the General tab of the DOCUMENT Property Pages dialog box. Right-click on the page and select Properties to display the DOCUMENT Property Pages dialog box (see Figure 5).


Interesting Fact #2: VB.NET supports declaring a variable and assigning a value to it on the same line, for example: <span class="pf">Dim intCounter As Integer = 10</span>.
You're probably wondering, what's the difference between the two layout modes? GridLayout provides absolute positioning for controls placed on the page. Developers that have their roots in rich-client development environments like Visual Basic will find it easier to develop their pages using absolute positioning, because they can place items exactly where they want them. On the other hand, FlowLayout positions items down the page like traditional HTML. Experienced Web developers favor this approach because it results in pages that are compatible with a wider range of browsers.
Figure 5: Use the DOCUMENT Property Pages dialog box to configure settings of a page. Commonly used settings include Page title, Default scripting language, Page Layout, and Keywords.
Which layout should you use? Flowlayout is the safer route, however, absolute positioning is appropriate for an intranet application when you are sure all of your users will have a compatible browser.

While you still have the Property Pages dialog box open, go ahead and change the Page Title to My First Web Form. Click OK to close the dialog box.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date