0% found this document useful (0 votes)
25 views

Dy, Olivar, Dela Cruz

This document provides an overview of ASP and ASP.NET, including: 1. ASP is a server-side scripting technology that uses scripts interspersed with HTML and interacts with databases using intrinsic objects and ADO. ASP.NET was created to address ASP's challenges like coding overhead and maintainability. 2. ASP.NET uses compiled languages, is faster and more scalable than ASP. Pages are executed via HTTP requests and responses, and controls are rendered as HTML, CSS and JavaScript. 3. ASP.NET includes built-in server controls that map to properties and provide richer functionality than HTML controls. Validation, list, intrinsic and rich controls are included.

Uploaded by

Matining Arnold
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Dy, Olivar, Dela Cruz

This document provides an overview of ASP and ASP.NET, including: 1. ASP is a server-side scripting technology that uses scripts interspersed with HTML and interacts with databases using intrinsic objects and ADO. ASP.NET was created to address ASP's challenges like coding overhead and maintainability. 2. ASP.NET uses compiled languages, is faster and more scalable than ASP. Pages are executed via HTTP requests and responses, and controls are rendered as HTML, CSS and JavaScript. 3. ASP.NET includes built-in server controls that map to properties and provide richer functionality than HTML controls. Validation, list, intrinsic and rich controls are included.

Uploaded by

Matining Arnold
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

ASP.

NET
Dy,
Olivar,
Dela Cruz
What is ASP?(Active Server Page)
• Server-side programming technology
• Consist of static HTML interspersed with script
•  ASP intrinsic objects (Request, Response, Server, Application, Session)
provide services.
• Commonly uses ADO to interact with databases
• Application and session variables
• Application and session begin/end events
• ASP manages threads, database connections
ASP Successes
• Simple procedural programming model
• Access to COM components
• ActiveX Data Objects (ADO)
• File System Object
• Custom components
• Script-based: no compiling, just edit, save & run
• VBScript, JScript – leverages existing skills
• Support for multiple scripting languages
ASP Challenges
• Coding overhead (too much code)
• Everything requires writing code!
• Code readability (too complex; code and UI intermingled)
• Maintaining page state requires more code
• Reuse is difficult
• Supporting many types of browsers is difficult
• Deployment issues (e.g. DLL locking)
• Session state scalability and availability
• Limited support for caching, tracing, debugging, etc.
• Performance and safety limitations of script 
ASP Goal
• Keep the good parts of ASP and improve the rest
• Simplify: less code, easier to create and maintain
• Multiple, compiled languages
• Fast
• Scalable
• Manageable
• Available
• Customizable and extensible
• Secure
• Tool support 
How ASP.net Work
• ASP.NET applications are executed via a sequence of HTTP requests
and HTTP responses.
• Client Web browser request ASPX pages.
• IIS passes the request to the ASP.NET engine on the server.
• The Web server executes the ASPX page and produce XHTML + CSS +
JavaScript
• ASP.NET file is returned to the browser as plain HTML
ASP.net Object Model
• User code executes on the web server in page or control event
handlers
• Controls are objects, available in server-side code
• Derived from System.Web.UI.Control
• The web page is an object too
• Derived from System.Web.UI.Page which is a descendant of
System.Web.UI.Control
• A page can have methods, properties, etc.
ASP Code behind Pages
• Two styles of creating ASP.NET pages
• Controls and code in .aspx file
• Controls in .aspx file, code in code-behind page
• Supported in Visual Studio.NET
• Code-behind pages allow you to separate the user interface design
from the code
• Allows programmers and designers to work independently

<%@ Codebehind=“WebForm1.bas” Inherits=WebApplication1.WebForm1” %> 


Page syntax
• The most basic page is just static text
• Any HTML page can be renamed .aspx
• Pages may contain:
• Directives: <%@ Page Language=“VB” %>
• Server controls: <asp:Button runat=“server”>
• Code blocks: <script runat=“server”>…</script>
• Data bind expressions: <%# %>
• Server side comments: <%-- --%> 
• Render code: <%= %> and <% %>
• Use is discouraged; use <script runat=server> with code in event handlers instead
Page Directives
• Lets you specify page-specific attributes, e.g.
• AspCompat: Compatibility with ASP
• Buffer: Controls page output buffering
• CodePage: Code page for this .aspx page
• ContentType: MIME type of the response
• ErrorPage: URL if unhandled error occurs
• Inherits: Base class of Page object
• Language: Programming language
• Trace: Enables tracing for this page
• Transaction: COM+ transaction setting
• Only one page directive per .aspx file
Server Control Syntax
• Controls are declared as HTML tags with runat=“server” attribute
<input type=text id=text2 runat=“server” />
<asp:calendar id=myCal runat=“server” />
• Tag identifies which type of control to create
• Control is implemented as an ASP.NET class
• The id attribute provides programmatic identifier
• It names the instance available during postback
• Just like Dynamic HTML
Server Control Properties
• Tag attributes map to control properties

<asp:button id=“c1" Text="Foo" runat=“server”>


<asp:ListBox id=“c2" Rows="5" runat=“server”>

• Tags and attributes are case-insensitive


• Control properties can be set programmatically

c1.Text = “Foo”
c2.Rows = 5 
Server Controls
• ASP.NET ships with ~50 built-in control
• Organized into logical families
• HTML controls
• Controls / properties map 1:1 with HTML
• Web controls
• Richer functionality
• More consistent object model
HTML Controls
• Work well with existing HTML designers
• Properties map 1:1 with HTML
table.bgcolor ="red"
• Can specify client-side event handlers
• Good when quickly converting existing pages
• Derived from
System.Web.UI.HtmlControls.HtmlControl
• Supported controls have custom class, others derive from
HtmlGenericControl
Supported Controls
• <a> • <input type=submit>
• <textarea> • <td>
• <img> • <input type=button>
• <button> • <th>
• <form> • <input type=reset>
• <input type=text> • <select>
• <table> • <input type=hidden>
• <input type=file>
• <tr>
Web Control
• Web Controls provide extensive properties to control display and
format, e.g.
• Font
• BackColor, ForeColor
• BorderColor, BorderStyle, BorderWidth
• Style, CssClass
• Height, Width
• Visible, Enabled
Types of Web Controls
• Intrinsic controls
• List controls
• Rich controls
• Validation controls
Intrinsic Control
• Correspond to HTML controls
• Supported controls
• <asp:button>
• <asp:radiobutton>
• <asp:imagebutton>
• <asp:image>
• <asp:linkbutton>
• <asp:label>
• <asp:hyperlink>
• <asp:panel>
• <asp:textbox>
• <asp:table>
• <asp:checkbox>
List Control
• Controls that handle repetition
• Supported controls
• <asp:dropdownlist>
• <asp:listbox>
• <asp:radiobuttonlist>
• <asp:checkboxlist>
• <asp:repeater>
• <asp:datalist>
• <asp:datagrid>
Rich Control
• Custom controls with rich functionality
• Supported Controls
• <asp:calendar>
• <asp:adrotator>
• More will be added
• 3rd party controls are coming
• Demo: RichControls1.aspx
Validation Control
• <asp:RequiredFieldValidator>
• Ensures that a value is entered
• <asp:RangeValidator>
• Checks if value is within minimum and maximum values
• <asp:CompareValidator>
• Compares value against constant, another control or data type
• <asp:RegularExpressionValidator>
• Tests if value matches a predefined pattern
• <asp:CustomValidator>
• Lets you create custom client- or server-side validation function
• <asp:ValidationSummary>
• Displays list of validation errors in one place
Validation Control
• Validation controls are derived from
System.Web.UI.WebControls.BaseValidator, which is derived from the
Label control
• Validation controls contain text which is displayed only if validation
fails
• Text property is displayed at control location
• ErrorMessage is displayed in summary
Hello World. asp
Hello World . aspx

You might also like