ASP.NET
  Home arrow ASP.NET arrow Building a Web Form in ASP.NET
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Building a Web Form in ASP.NET
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 36
    2006-06-08

    Table of Contents:
  • Building a Web Form in ASP.NET
  • How to use flow layout
  • How to add a table to a form
  • How to add server controls to a form
  • How to work in Source view

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building a Web Form in ASP.NET


    (Page 1 of 5 )

    Before you can build your first ASP.NET application, there are certain skills you need to master. This article, the second of three parts, gets you started with building a web form. It is excerpted from the book Murach's ASP.NET 2.0 Web Programming with VB2005, written by Doug Lowe (Murach, 2006; ISBN: 1890774324).

    How to use Design view to build a web form

    Now that you know how to start, open, and close a web site, you’re ready to learn how to build a web form. To start, I’ll show you the web form that you’re going to build. Then, I’ll show you how to build it.

    The design of the Future Value form

    Figure 2-5 presents the design of a Future Value web form that calculates the future value of a fixed monthly investment. This form has enough features to give you a realistic idea of what’s involved in the development of a form, but it’s so simple that you won’t be overwhelmed by detail. In this case, the entire application consists of this single form.

    If you study the form, you can see that it contains six web server controls. These controls are derived from ASP.NET classes, and they have special features that make them suitable for web applications. This form contains one drop-down list, two text boxes, one label, and two buttons. These controls are analogous to the ones that you use for Windows applications.

    When you click on a button in a web form, it automatically starts a postback to the server. When you click the Calculate button, for example, the application calculates the future value based on the values in the drop-down list and two text boxes. The result is displayed in the label when the form is returned to the browser. When you click on the Clear button, the text boxes and label are cleared and the value in the drop-down list is reset to 50.

    In contrast to the web server controls, the image at the top of this page (the Murach logo) is stored in an HTML server control. This is a second type of server control that you can use on a web form. The third type is a validation control, which you’ll learn about later in this chapter.

    The arrangement of the web server controls on this web form is done through an HTML table. Above the table, a heading has been entered and formatted. In the first column of the first four rows of the table, text has been entered that describes the data in the second column. The fifth row of the table contains no text or controls. And the six row contains the two buttons.

    In the rest of this chapter, you’ll learn how to build this web form, how to add validation controls to it, and how to write the code for its code-behind file. Then, you’ll learn how to test a web application. At the end of this chapter, you’ll find exercises that will walk you through the development of this Future Value application and help you experiment with other features of Visual Studio.

    Throughout this chapter, please note that the term page is sometimes used to refer to a web form. That’s because a web form represents a page that’s sent to a browser.

    The Future Value web form in a browser


    Figure 2-5.  The design of the Future Value form

    The six web server controls used by the Future Value form

    1. The drop-down list can be used to select a monthly investment value ranging from 50 to 500.
    2. The two text boxes are used to enter values for the annual interest rate and the number of years that the monthly payments will be made.
    3. The label is used to display the future value that is calculated.
    4. The Calculate and Clear buttons are used to post the form back to the server and initiate the processing that needs to be done. 

    Description

    1. Besides the web server controls, the Future Value form uses an HTML server control to display the image at the top of the form, and it uses text to display the heading below the image. It also uses an HTML table to align the text and web server controls below the image and heading.
    2. When the user clicks on the Calculate button, the future value is calculated based on the three user entries and the results are displayed in the label control.
    3. When the user clicks on the Clear button, the two text boxes and the label are cleared and the drop-down list is reset to a value of 50.
    4. To end the application, the user can click the Close button in the upper right corner of the browser window.

    More ASP.NET Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach's ASP.NET 2.0 Web Programming with...
     

    Buy this book now. This article is excerpted from the book Murach's ASP.NET 2.0 Web Programming with VB2005, written by Doug Lowe (Murach, 2006; ISBN: 1890774324). Check it out today at your favorite bookstore. Buy this book now.

    ASP.NET ARTICLES

    - ASP.NET DotNetNuke Installation with Visual ...
    - Using ASP.NET with a MySQL Database
    - Using ASP.NET with an MS Access Database
    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek