Exforsys

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality

Ads


Home arrow Technical Training arrow ASP.NET 2.0

Creating an ASP.NET Application

Page 1 of 2
Author : Exforsys Inc.     Published on: 11th Aug 2005    |   Last Updated on: 21st Nov 2007

Creating an ASP.NET Application

In this tutorial you will learn how to Create an ASP.NET 2.0 Application, Examining the Interface, The Hello World Application, Designing Web Forms, The Embedded Web Server and Important folders in the ASP.NET 2.0 Applications.


Ads

Visual Studio.NET is a user friendly way to create web sites. It provides for multiple ways of opening websites. Frontpage Server extensions, FTP or direct file system path can be used to open the web pages. The inbuilt web server Cassini makes IIS server optional for testing and debugging of applications. ASP.NET 2.0 uses the dynamic compilation engine to compile its files and changes to .aspx, .cs or .vb files are caught immediately.

The copy website feature eases the process of copying websites from one location to a local or remote computer. Additionally double clicking on a .aspx file opens Visual Studio.NET 2005 and enables the editing of source code. The Intellisense is an intelligent tool that helps the developer view the pages in a browser or examine issues relating to data binding or page directives with ease.

Before actually creating a sample let us see what the interface has to offer to the web developer.

Examining the Interface

1. Open a new Web site by clicking File >New web site.

2. A new website project dialog box opens asking the user to pick out the type of website required. Select ASP.NET web site.

3. A minimum number of pages required for setting up a website are generated by Visual Studio.NET. A default .aspx file and an empty directory are created to help you start the project.

4. It must be pointed out that though ASP.NET 2.0 creates a project file it does not track the files that form a part of the application. The root directly implicitly defines the web project. A new file can be added to the project by copying a file onto the project or right clicking the solution explorer and adding a file to it.

5. Also note that the above dialog box allows the developer to specify the location of the project and the language of choice.

6. A web page can be edited by navigating to the Design, source or the sever code views. The Design view displays a HTML layout. It lets the user select controls or static elements and edit them. The user has a graphical preview of what his web page will look like. The source view displays the HTML markup with the inline code. IntelliSense tips, autocompletion and colored syntax help the developer in multitude of ways. The server code view displays only the inline code with the colored syntax.

7. The user can chose the kind of template he wants to add to his application. To select a template right click on the root of the project and click on Add New item…

8. A number of different types of templates are displayed for the selection of the developer.

Ads

9. Two check boxes at the bottom of the page allow the separation of the code and the selection of a master page. The restructured code-behind schema of Visual Studio 2005 supports separation of code but makes it optional. The file is automatically named as default1 or default2 .aspx and so on. The language selected for the project is displayed in the language box. However, the user is free to select different languages for different pages.

The Hello World Application

In the manner of the traditionalists let us create the Hello world application. Let us select a web form and place a textbox and a button.

Enter the following code in the source view of the Default.aspx page.

Click here to view sample code

  <%@ PageLanguage="C#"CodeFile="Default.aspx.cs"Inherits="Default_aspx"%> 

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">" target="_blank" rel="nofollow";
<scriptrunat="server">
    void send_Greeting(Object sender, EventArgs e)
    {
        Greet.Text = Msg.Text;
    }
 </script>
<htmlxmlns="http://www.w3.org/1999/xhtml"" target="_blank" rel="nofollow";>
<headrunat="server">
    <title>Hello World</title>
</head>
<body>
    <formid="form1"runat="server">
    <h1> Traditional Message to the world </h1>
    <div>
        <asp:TextBox runat="server"ID="Msg"text="Hello, World"/>
        <asp:Button runat="server"ID="Greet"Text="Greet" OnClick="send_Greeting"/></div>
    </form>
</body>
</html>

Now rename the page as greetings.aspx by right clicking on the page in solutions Explorer and changing its name. We shall now execute the code by clicking on control + F5 or right clicking on the file in the Solution Explorer and selecting View in Browser. The page appears as under.



 
This tutorial is part of a ASP.NET 2.0 tutorial series. Read it from the beginning and learn yourself.

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality
 

Comments