Download presentation
Presentation is loading. Please wait.
Published byErica Ross Modified over 9 years ago
1
1 Presented by Bikash Shrestha
2
2 What is ASP.NET or ASP+? ASP.NET/ASP+ is a programming framework built on the common language runtime that can be used on a server to build powerful Web applications.
3
3.NET Architecture
4
4 What is ASP.Net? Next generation of ASP New paradigm for server side scripting Part of new.net framework
5
5 Why ASP.NET? Easy Programming Model Avoids spaghetti code Great pages with far less code than ASP Easy display data Easy validating user input Easy uploading files Works in all browser ( including Netscape, Opera, AOL, and IE)
6
6 Why ASP.NET? Flexible Language Options ASP support VBScript and Jscript ASP.NET supports 25.NET languages Includes built in support for VB.NET, C++, C#, and JScript.NET
7
7 Why ASP.NET? Rich Class Framework.NET Framework offers over 4500 classes that encapsulates rich functionality like XML, data access, file upload, regular expressions, image generation, performance monitoring and logging, transactions, message queuing, SMTP mail, and more
8
8 Why ASP.NET? Improved performance & Scalability 3 to 5 times faster than ASP Due to dynamic compilation Rich Output Caching Eliminates the need to query the database on every request improve performance of data-driven pages
9
9 Compatibility Not fully compatible with ASP, however can run side by side with older versions. Instead of.asp it uses.aspx extensions.
10
10 Syntax and Semantics ASP.NET fully API-compatible with traditional ASP except Request() Request.QueryString() Request.Form() ASP.NET returns string ASP returns array of strings
11
11 For ASP.NET Cnn.com/Test.aspx?value=45&valu e=600 would be accessed as follows: <% ' Below line outputs: "45, 600" Response.Write(Request.QueryString("values")) ' Below line outputs: "45" Response.Write(Request.QueryString.GetValues("value s")(0)) %>
12
12 Syntax & Semantics ASP.NET pages support only a single language. ASP.NET page functions must be declared in blocks unlike in ASP.
13
13 Syntax & Semantics Page-render functions are not supported Example IN ASP <% Sub RenderSomething() %> Here is the time: <% RenderSomething RenderSomething %>
14
14 Syntax & Semantics Example IN ASP.NET Sub RenderSomething() Response.Write(" ") Response.Write("Here is the time: " & Now) End Sub <% RenderSomething() RenderSomething() %>
15
15 Display Hello World in ASP.NET Save the file as an.aspx extension Hello W3Schools! first aspx code to display "hello world"
16
16 Limitation of Classic ASP Code has to be placed where the output apprears Impossible to separate ASP code from HTML Eg. Hello W3Schools!
17
17 ASP.NET - Server Controls The "spaghetti-code" problem solved with server controls. Server controls are tags that are understood by the server. Three kinds of server controls: HTML Server Controls - Traditional HTML tags Web Server Controls - New ASP.NET tags Validation Server Controls - For input validation
18
18 HTML Server Controls HTML tags understood by server. Comparable to JavaScript but run at server Regular HTML elements are, by default, treated as text. Add runat="server" to HTML elements to make it programmable and to be run at server. must be within a tag id attribute is added to identify the server control They can be used at a run time.
19
19 Example of HTML Server Control Sub Page_Load link1.HRef="http://www.w3schools.com" End Sub Visit W3Schools! anchor example
20
20 HTML Server Control contd… HTMLButton HTMLImage 2 HTMLInputbutton HTMLInputCheckbox HTMLInputHidden HTMLInputImage HTMLInputRadiobutton HTMLTable HTMLTextarea
21
21 ASP.NET - Web Server Controls ASP.NET tags understood by the server Like HTML Server Controls, require runat="server" to execute in server Like HTML Server Controls, require id. Does not map to HTML Elements. More complex elements
22
22 ASP.NET - Web Server Controls contd… AdRotator Calendar CheckboxList DropdownList Hyperlink Image Label Listbox Literal Panel RadiobuttonList Table
23
23 ASP.NET - Validation Server Controls Used to validate user-input If invalid data, display an error message to the user By default, page validation performed when Button, ImageButton, or LinkButton control is clicked Prevent validation by changing CausesValidation property to false.
24
24 ASP.NET - Validation Server Controls contd… CompareValidator CompareValidator CustomValidator CustomValidator RangeValidator RangeValidator RegularExpressionValidator RegularExpressionValidator RequiredFieldValidator RequiredFieldValidator Validationsummary Validationsummary
25
25 ASP.NET - Events An Event Handler is a subroutine that executes code for a given event. Example of The page load eventThe page load event Example of The Page.IsPostBack PropertyThe Page.IsPostBack Property
26
26 ASP.NET Web Forms All server controls must appear within a tag By default the page is submitted to itself. If action is set then method=“post “ by default as in Classic ASP An.aspx page can only contain ONE control! Submitting a Form Example Self PostingSelf Posting
27
27 ASP.NET Data Binding Data binding is used to fill lists with selectable items from an imported data source, like a database, an XML file, or a script. Usually uses an imported source. the data is separated from the HTML any changes to the items are made in the separate data source. The following controls support data binding asp:RadioButtonList asp:CheckBoxList asp:DropDownList asp:Listbox
28
28 Data Binding - ArrayList Object The ArrayList object is a collection of items containing a single data value. Example - ArrayList RadioButtonListArrayList RadioButtonList
29
29 Data Binding - The Hashtable Object The Hashtable object contains items in key/value pairs. Cannot sort items. Example- Hashtable DropDownList Hashtable DropDownList A Hashtable object may automatically generate the text and values to the following controls: asp:RadioButtonList asp:CheckBoxList asp:DropDownList asp:Listbox
30
30 Other Data Binding Controls SortedList object It combines the features of both the ArrayList object and the Hashtable object. XML Files We can bind a XML files to get data. Example of XML Data BindingExample of XML Data Binding The Repeater It is used to display a repeated list of items that are bound to the control. May be bound to a database table, an XML file, or another list of items example of Repeaterexample of Repeater The DataList Same as Repeater, except it adds a table around the data items by default. DataList DataList DataList
31
31 ASP.NET Database connection To work with databases we need ADO.NET, which is a part of the.NET Framework and it is used to handle data access. What is ADO.NET? part of the.NET Framework consists of a set of classes to handle data access is entirely based on XML unlike ADO, has no Recordset object Example of : Database connection - Repeater control Database connection - Repeater control
32
32 Helpful Hints Most of my work are from http://www.w3schools.com/ http://www.w3schools.com/ http://www.asp.net/Tutorials/quickstart.aspx http://www.asp.net/Tutorials/quickstart.aspx http://www.microsoft.com/net and http://www.microsoft.com/net Beginning ASP.NET 1.0 with Visual Basic.NET published by wrox Programmer to Programmer ISBN 1-861007-33-7 Also to download this slides you can check at http://fall2003.cs.mnsu.edu/shresb2/aspPresentation.ppt http://fall2003.cs.mnsu.edu/shresb2/aspPresentation.ppt
33
33 Thank you Open for questions or concerns
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.