ASP.NET applications require only a text editor, such as Notepad. However, creating an ASP.NET application in a text editor involves a lot of HTML and ASP.NET coding. To create ASP.NET applications easily and efficiently, you can use a tool developed by Microsoft called Visual Studio .NET.
Visual Studio .NET provides you with several features and utilities that help you create ASP.NET applications. For example, Visual Studio .NET provides you with different templates that you can use to create ASP.NET Web applications and ASP.NET Web services. In addition, you can create ASP.NET applications in any of the .NET languages, such as Visual C# and Visual Basic .NET.
In this chapter, you will create an ASP.NET Web application in Visual Basic .NET.
When you use the template that Visual Studio .NET provides to create an ASP.NET application, Visual Studio .NET creates the default classes for the application. In addition, it automatically includes the required namespaces in your application This implies that Visual Studio .NET creates a framework for the application. You can then add the code of the application to this framework.
Visual Studio .NET provides you with the color schemes for keywords and values, making them easier to read and understand. In addition, Visual Studio .NET includes an auto complete feature that completes the entries as you type the code. Visual Studio .NET also includes an auto help feature that provides instant help on any of the keywords, such as the class, event, and method names. You will learn about these and many more features of Visual Studio .NET throughout this project.
Creating a Sample ASP.NET Application
To create an ASP.NET Web application in Visual Studio .NET, perform the following steps:
The Interface for Visual Studio .NET
The New Project Dialog Box
As you can see, the New Project dialog box offers you various templates to create different applications.
In our case, the development server is the local computer, so the address of the development server will appear as http://localhost/.
The Web application connects to the Web server, as shown in Figure.
The Web Application Connecting to a Web Server
The Web application opens in the Design view. The Design view of the Web application is shown in Figure.
The Design View of the Web Application
When a Web application is created, Visual Studio .NET creates a blank Web form with the name WebForm1.aspx, as shown in Figure. You can also include several Web forms in a Web application.
The Web Form that Visual Studio .NET Created
A Web form is a user interface for a Web application and is used to create programmable and interactive Web pages. A Web form consists of two parts: an interface that accepts user input or presents information to the user, and the code behind the interface that implements the business logic of the application. To accept input from a user, you need to include Web form controls in the Web form. The Web form controls are explained in the following section.
Web Form Controls
Visual Studio .NET provides you with several Web form controls that you can add by dragging them to the form. Web form controls contain a variety of controls that are designed to work within the ASP.NET page framework. These Web form controls are shown in Figure ASP.NET supports different types of Web form controls or server controls. Table discusses the types of Web form controls in detail.
Types of Web Form Controls
Default Files in a Web Application
In addition to a Web form, Visual Studio .NET creates default files for a Web application. These default files are included in a solution.
A solution is a collection of projects or related projects. For example, you can include a project and its deployment projects in the same solution.
A solution for WebApplication1 is shown in Figure.
The Default Files that Visual Studio .NET Created
Table discusses in detail the default files that Visual Studio .NET created.
The Default Files in a Web Application
Creating an Interface for Web Application1
To create an interface for the sample Web application, you need to include an Image control, six Label controls, one Button control, five TextBox controls, and one ListBox control in the Web form. To add these controls, you need to drag them from the Web Forms toolbox and place them on the form. Next, you need to change the properties of the controls, as listed in Table.
Controls in the Web Form
Adding Items to the ListBox Control
As you can see, we have added a list box to the form. You can now add items to the ListBox control by performing the following steps:
The Web Form in the Design View
However, the button in the Web form is not functional. To make the button functional, you need to add code to it.
Adding Code to the Submit Button
When a user enters values in the text boxes and clicks on the Submit button, the text boxes should become blank. To do this, add the following code to the Click event of the Button control:
After you have added the code to the Button control, the entire code for the application is as follows:
The code contains the declarations for all controls that you added to the Web application. In addition, the code for the Click event of the Button control is included.
Testing the Application
You can now run the application to test it. To test the application, press the F5 key. Alternatively, you can select the Start option on the Debug menu. Figure shows the Web form at runtime.
The Web Form at Runtime.
Until now, you learned to create a simple ASP.NET application. However, in most common business scenarios, the ASP.NET application needs to interact with a database. This can be achieved using the ADO.NET technology in an ASP.NET application.
XML Related Interview Questions
|Soap Tool Interview Questions||HTML Interview Questions|
|PHP Interview Questions||ASP.NET Interview Questions|
|PHP5 Interview Questions||Java Interview Questions|
|CSS Interview Questions||XSLT Interview Questions|
|Java XML Interview Questions||XMLHttpRequest (XHR) Interview Questions|
|ebXML Interview Questions||XML DOM Interview Questions|
|XML-RPC Interview Questions||XSD Interview Questions|
|Soap Web Services Interview Questions||XSL Interview Questions|
|Xml Publisher Interview Questions|
Basics Of Xml
Basics Of Web Services
Introduction To Soap
Introduction To Uddi
Introduction To Wsdl
Creating A Web Service Using The Microsoft Soap Toolkit
Building Web Applications On The .net Platform
Creating An Asp.net Web Service
Creating A Web Service From An Interface
Introduction To The Atl Server
Creating A Web Service Using The Atl Server Library
Design And Creation Of The Knowledge Share Web Service
Introduction To Java Xml Technologies
Developing Java Web Services
Design And Creation Of A Web Service Using The Ibm Toolkit
Introduction To Mobile Applications
Creating A Mobile Application That Consumes A Web Service
Web Services Development With Jdeveloper
Creating Web Services Using Perl
Integration Of Xml Web Services With The Office Xp And Sql
Server 2000 Toolkits
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.