Revision: Intro To Asp Web Application Development
Revision: Intro To Asp Web Application Development
NET
INTRO TO ASP WEB APPLICATION DEVELOPMENT
Revision
A web page is an HTML document i.e. .html or .htm. A web browser renders this HTML
document and displays the content and format of the webpage.
Learners should understand the process involved when a webpage is requested from a
server and displayed on the internet browser. (Ref: pg. 780 of prescribed text)
Page 1 of 4
Design the web form using controls from the toolbox. Insert a table onto the webpage from
menu item table (page 796). Then place various controls within each cell of the table.
7. A programmer can make use of Cascading Style Sheets (CSS) to develop more attractive
webpages i.e. format colour, background etc. Pages 791-792.
8. Add code to the code behind file.
Open the code behind file i.e. aspSet1.aspx.cs.
The webpage has a page_load event. Change this to page_init event for when the page is
requested by the server.
Add code: txtTime.Text = DateTime.Now.ToString("hh:mm:ss");
9. Set the start page by right-clicking on the .aspx file, set as start page.
10. Run the program
Save the solution first.
Right click; view solution in browser
Or debug, but this must be set in the Web.config file.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td class="style2" colspan="2" style="font-size: x-large">
<b>asp .NET Set One</b></td>
</tr>
<tr>
Page 2 of 4
<td>
<asp:Label ID="Label1" runat="server" Text="Time:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtTime" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
1. This partial class inherits from class Page in the System.Web.UI namespace which
contains classes and controls for creating web forms.
2. The web application functionality is coded (either in VB or C#) in the code behind file.
This can include any calculations, validations etc.
Page 3 of 4
2. When compiled ASP.NET will combine both to form one complete class. This explains
why the control can be accessed from a second partial class i.e. the code behind file.
3. The markup for the controls will be taken from class WebControls of namespace
System.Web.UI.
4. The first time the web form is requested, it is compiled and an instance is created and
stored on the local machine. Every time a client browser requests this web form, an
instance of the web form is sent. Hence multiple clients can view the same web page at
the same time.
Web controls
Textbox; button; hyperlink; dropdown list; radio button list; image; panel.
Page 4 of 4