Docsity

Learning Web Development with Microsoft Visual Studio 2012: Creating ASP.NET Applications, Slides of Computer Programming

Partial preview of the text

Download Learning Web Development with Microsoft Visual Studio 2012: Creating ASP.NET Applications and more Slides Computer Programming in PDF only on Docsity!

Web Development in

Microsoft Visual Studio

Lecture Overview

 Introduce Visual Studio 2012  Create a first ASP.NET application

Visual Studio Windows

 The Toolbox contains HTML controls and ASP.NET controls  Drag control instances using Design or Source view  The Solution Explorer lists the application’s files  The Properties window is used to set object properties  Other windows work as you would expect

Creating an ASP.NET

Application (Web Site)

 You create a Web site in much the same way as you create a desktop project  Click File / New / Web Site  In the New Web Site dialog box  Select ASP.NET Web site  Select the desired folder (The folder should be empty or not already exist)  Note that different framework versions are supported

Solution Explorer Files (1)

 Web forms (.aspx) make up the visual forms  They are HTML5 documents  There is a code behind file (.aspx.cs)  Web.config contains configuration information  It’s an XML document

Solution Explorer Files (2)

 If you select a Web Forms site,  Jquery is included in the default template  Site.master contains the application menu  Styles contain cascading style sheets (.css)

Parts of the Designer Surface

 Most windows work as you expect but the contents differ from those you see in desktop applications  Solution Explorer contains project files but these files are very different from desktop files  Toolbox controls look like desktop controls but they are not desktop controls  The visual designers work differently too

Adding a Web Form

 Every .aspx file corresponds to a Web page  Click Website / Add New Item  Select Web Form  Select the master page, if desired  Set the name as desired

The Web Form Editor

 The Web Form editor allows you to  Create HTML  Create ASP.NET server side tags  Create the “code behind” the form in a language such as Visual Basic or C#  The Web form editor has three views  Design / Split / Source

The Web Form Editor

Default Web Page (HTML)

The Code Editor

 An ASP.NET Web page is made up of two files  The .aspx file contains the HTML  The .aspx.cs file contains the VB or C# code  It works the same way as the Code Editor for desktop applications  The event names differ a bit  Page_Load instead of Form_Load for example

Toolbox Controls

 They are different controls than those used for desktop applications  HTML controls are standard HTML controls that will work with any browser  Other controls are server side controls that only work with IIS and ASP

Using Controls

 Using the Toolbox, drag the desired control to the design surface  You can drag to the design surface or the HTML editor  Set properties using the Properties window  Create event handlers using the Properties window