SlideShare a Scribd company logo
1 of 26
Developing Web Applications Using ASP.NET
Objectives


                In this session, you will learn to:
                   Explain the differences between HTML controls and Web
                   server controls
                   Describe the different types of Web server controls
                   Explain how to use HTML controls and Web server controls
                   Explain how the postback model of ASP.NET 2.0 works
                   Create Web-based user interfaces with HTML controls and
                   Web server controls
                   Write code that interacts with Web server controls
                   Write code that interacts with the postback model of ASP.NET
                   2.0




     Ver. 1.0                                                           Slide 1 of 26
Developing Web Applications Using ASP.NET
HTML Controls and Web Server Controls


                HTML Controls:
                   HTML controls are used to add static HTML elements to a Web
                   page.
                   By default, HTML controls are not accessible to the server-side
                   code in the Web page.
                   To enable your server-side code to interact with HTML
                   controls, you must specify that the control runs on the server.
                Web Server Controls:
                   Web Server controls are .NET Framework objects that are
                   converted by ASP.NET to HTML elements at run time.
                   On receiving a request for a Web page containing Web server
                   controls, ASP.NET :
                      Generates HTML output based on the Web server controls.
                      Returns the HTML output to the browser.



     Ver. 1.0                                                               Slide 2 of 26
Developing Web Applications Using ASP.NET
HTML Controls and Web Server Controls (Contd.)


                Difference between HTML controls and Web server
                controls:
                   Web Server controls are more versatile than HTML controls if
                   you wish to run server-side code associated with controls.
                   Web Server controls incur more overhead when processing the
                   page as compared to HTML controls.
                   Web Server controls support a rich programming model as
                   compared to their HTML equivalents.




     Ver. 1.0                                                          Slide 3 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls


                Visual Studio 2005 groups Web server controls together in
                the Toolbox, based on their functionality.
                The various groups of controls are:
                   Standard Controls
                   Data Controls
                   Validation Controls
                   Navigation Controls
                   Login Controls
                   WebPart Controls




     Ver. 1.0                                                      Slide 4 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                Standard Controls:
                   This group contains controls that provide common user
                   interface elements.
                   Standard controls include:
                      TextBox
                      ListBox
                                              Standard Controls
                      DropDownList
                      Checkbox
                      RadioButton
                      Button
                      Image
                      Table
                      Calendar




     Ver. 1.0                                                              Slide 5 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                Data Controls:
                   This group contains controls used to manipulate data stored in
                   databases, XML files, and other .NET Framework objects.
                   Data controls include:
                      Grid View
                      SqlDataSource

                                       Data Controls




     Ver. 1.0                                                            Slide 6 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                Validation Controls:
                   This group contains controls that are used to validate user
                   input.
                   Simple validation is done on the client side by generating
                   JavaScript code. This reduces the load on the Web server and
                   improves responsiveness.
                   Complex validation is done on the Web server.
                   Validation controls include:
                       RequiredFieldValidator
                       CompareValidator



                                       Validation Controls




     Ver. 1.0                                                           Slide 7 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                Navigation Controls:
                   The controls in this group are used to enable the user to move
                   through the Web site.
                   Navigation controls include:
                      Menu
                      TreeView
                      SiteMapPath




                                        Navigation Controls




     Ver. 1.0                                                             Slide 8 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                Login Controls:
                   The controls in this group are used to create login and sign-up
                   pages for your Web sites.
                   Login controls include:
                      Login
                      ChangePassword
                      PasswordRecovery




                                              Login Controls




     Ver. 1.0                                                              Slide 9 of 26
Developing Web Applications Using ASP.NET
Types of Web Server Controls (Contd.)


                WebPart Controls:
                   The controls in this group can be used to build the framework
                   for dynamic Web pages.
                   These controls are typically used in portal-type Web
                   applications.
                   WebPart controls include:
                      WebPartManager
                      WebPartZone


                                       Web Part Controls




     Ver. 1.0                                                            Slide 10 of 26
Developing Web Applications Using ASP.NET
Working with Web Server Controls


                Methods for adding Web server controls to Web forms:
                   Drag and drop the control from the Toolbox onto the Design
                   view of the Web page.
                   Drag and drop the control from the Toolbox into the Source
                   view of the Web page.
                   Type the markup text for the control directly into the Source
                   view of the Web page.




     Ver. 1.0                                                              Slide 11 of 26
Developing Web Applications Using ASP.NET
Working with Web Server Controls (Contd.)


                Methods for Setting Web Server Control Properties at
                Design Time:
                   Select the control in the Design view and set the property
                   values in the Properties window.
                   Select the markup text for the control in the Source view and
                   set the property values in the Properties window.
                   Edit the markup text for the control directly in the Source view
                   of the Web page.




     Ver. 1.0                                                               Slide 12 of 26
Developing Web Applications Using ASP.NET
Working with Web Server Controls (Contd.)


                You can manipulate Web server controls at run time by:
                   Setting a writable property
                   Invoking a method
                   Reading a readable property
                    //Set a writable property
                    Textbox1.Text = “Hello World!”;
                    //Invoke a method
                    TextBox1.Focus();
                    //Reading a readable property
                    string sName = TextBox1.Text




     Ver. 1.0                                                      Slide 13 of 26
Developing Web Applications Using ASP.NET
The ASP.NET 2.0 Page Postback Model


                    Postback model provides a mechanism for:
                       Sending control properties on Web pages from the Web
                       browser to the Web server.
                       Restoring the values when a response is sent back from the
                       Web server to the Web browser.
                •   This model enables Web server controls to retain their
                    values over multiple requests to the server.
                •   It enables you to develop Web pages as if they are part of a
                    stateful application.




     Ver. 1.0                                                               Slide 14 of 26
Developing Web Applications Using ASP.NET
The ASP.NET 2.0 Page Postback Model (Contd.)


                • AutoPostBack Property:
                   • Some Web server controls support the AutoPostBack
                     property.
                   • This property controls whether user interaction with the control
                     should invoke a round-trip request to the server.
                • EnableViewState Property:
                     This property determines whether the control should retain its
                     state for the duration of the postback.
                     This property should be set to true for those controls whose
                     properties are set in server-side code.




     Ver. 1.0                                                                Slide 15 of 26
Developing Web Applications Using ASP.NET
Cross-Page Posting in an ASP.NET Web Page


                •   By default, buttons and other controls that cause a postback
                    on a Web page submit the page back to itself.
                •   Controls can be configured to post to a different target page.
                •   To enable cross-page posting, you need to set the
                    PostBackURL property of a control to the URL of the target
                    page.
                •   To retrieve control values on the submitting page from the
                    target page, you can use the Page.PreviousPage object.
                •   To retrieve the public properties on the submitting page
                    from the target page, you need to include the
                    PreviousPageType directive in the target page as:
                     <%@ PreviousPageType VirtualPath=
                     “~/SourcePage.aspx” %>



     Ver. 1.0                                                             Slide 16 of 26
Developing Web Applications Using ASP.NET
Determine How an ASP.NET Web Page Was Invoked


                   A Web page can be invoked in a variety of ways:
                   •   By an original request
                   •   By a postback
                   •   By a cross-page post from another page
                   •   By transfer from another page by using the Server.Transfer
                       method
               •   To determine how a page was invoked, you can examine the
                   following properties of the Page object:
                   • Page.IsPostBack: This property is true when page is invoked
                     by a postback page and false otherwise.
                   • Page.PreviousPage: This property contains a reference to the
                     source page when the page is invoked by either a cross page
                     posting or a server transfer. In all other cases, it contains Null.
                   • Page.PreviousPage.IsCrossPagePostBack: This property
                     is true when the page is invoked by a cross page posting.

    Ver. 1.0                                                                 Slide 17 of 26
Developing Web Applications Using ASP.NET
The Button.OnClientClick Property


                •   Use the Button.OnClientClick property to specify
                    client-side script to be run when the Button object is
                    clicked.
                •   The code that you add to this property is added to the
                    onclick attribute of the control.




     Ver. 1.0                                                           Slide 18 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls


                Problem Statement:
                   You are a developer in the Adventure Works organization, a
                   fictitious bicycle manufacturer. You have been asked to assist
                   in the development of the Business-to-Consumer (B2C) Web
                   application and a related Business-to-Employee (B2E) extranet
                   portal.
                   Decisions on the design of the application have already been
                   taken. You have been asked to carry out a number of specific
                   tasks to implement various elements of this design.




     Ver. 1.0                                                           Slide 19 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls (Contd.)


                As part of the first phase of the B2C development, you have
                been asked to complete the prototypes for the following pages:
                   Survey.aspx. You will design a rich graphical user interface for this
                   page that enables users to submit responses to an online survey.
                   You will also add a SiteMapPath control to this page to aid user
                   navigation.
                   SurveyReceipt.aspx. You will design this page to receive the
                   information provided by the user in the Survey.aspx page.
                   FeedbackForm.aspx. You will design this page to receive the
                   information provided by the user in the existing Feedback.aspx
                   page.
                   Default.aspx. You will add a Menu control to this page to aid user
                   navigation.




     Ver. 1.0                                                                 Slide 20 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls (Contd.)


                You will also add and review a Web.sitemap file that will be
                used to add navigation features to the Web application.
                Additionally, you will add and review an advertising schedule
                file that will be used to add dynamic image display features to
                the Web application.




     Ver. 1.0                                                           Slide 21 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls (Contd.)


                Solution:
                 • To solve this problem, you need to perform the following tasks:
                     1. Build the Graphical User Interfaces with HTML Controls
                         a. Review the proposed design of the Survey.aspx page.
                         b. Open the Adventure Works Web site.
                         c. Define the Survey.aspx page layout by using HTML controls in Design view.
                         d. Define the Survey.aspx page layout by modifying HTML markup in Source
                            view.
                         e. Add HTML Input controls to the Web page.




     Ver. 1.0                                                                             Slide 22 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls (Contd.)


                1. Build Graphical User Interfaces with Web Server Controls
                    • Review the proposed design of the Survey.aspx page.
                    • Refine the Survey.aspx page layout by using an ASP.NET Table Web server
                      control in Design view.
                    • Modify the properties of the Table Web server control.
                    • Add rows to the Table Web Server control by using Source view.
                    • Add a nested Table Web server control in Source view.
                    • Add Web server controls to the Table control.
                    • Add site navigation functionality by using Web server controls.
                    • Incorporate advertising functionality with Web server controls.




     Ver. 1.0                                                                       Slide 23 of 26
Developing Web Applications Using ASP.NET
Demo: Adding and Configuring Server Controls (Contd.)


                1. Program Web Server Controls and Work with Postbacks
                    • Manage the Click event for the ImageMap object.
                    • Create the OnClientClick property and the server-side Click event for
                      the Submit button.
                    • Determine if an ASP.NET Web page was invoked as part of the postback
                      process.
                    • Create a page that can receive and process information submitted as part of a
                      cross-page postback.
                    • Test the Web application.




     Ver. 1.0                                                                            Slide 24 of 26
Developing Web Applications Using ASP.NET
Summary


               In this session, you learned that:
                   HTML controls are representations of HTML markup which are
                   not accessible to the server side code.
                   Web server controls are .NET Framework objects that are
                   converted by ASP.NET to HTML elements at run time.
                   Visual Studio 2005 provides many groups of Web server
                   controls based on their functionality, such as Standard
                   Controls and Data Controls.
                   You can add Web server controls to Web forms from the
                   Toolbox or by typing markup text.
                   You can set Web server control properties at design time as
                   well at run time.
                   The ASP.NET postback model is designed to provide stateful
                   rendering of dynamic content on a Web page.



    Ver. 1.0                                                          Slide 25 of 26
Developing Web Applications Using ASP.NET
Summary (Contd.)


               • The Page object exposes the IsPostBack property that you
                 can use to determine how a page was invoked.
               • You can configure the controls to post to a different target page
                 referred to as cross-page posting.
               • When a page is invoked by another page, you can retrieve
                 control values and public properties of the invoking page from
                 the invoked page.




    Ver. 1.0                                                             Slide 26 of 26

More Related Content

What's hot

Developing an aspnet web application
Developing an aspnet web applicationDeveloping an aspnet web application
Developing an aspnet web application
Rahul Bansal
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
Niit Care
 
Chapter6 web apps-tomcat
Chapter6 web apps-tomcatChapter6 web apps-tomcat
Chapter6 web apps-tomcat
Venkat Gowda
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
George Kanellopoulos
 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 

What's hot (20)

Developing an aspnet web application
Developing an aspnet web applicationDeveloping an aspnet web application
Developing an aspnet web application
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
Chapter6 web apps-tomcat
Chapter6 web apps-tomcatChapter6 web apps-tomcat
Chapter6 web apps-tomcat
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Asp net
Asp netAsp net
Asp net
 
Asp.net
Asp.netAsp.net
Asp.net
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
Integrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePointIntegrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePoint
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 servers
 
WSS And Share Point For Developers
WSS And Share Point For DevelopersWSS And Share Point For Developers
WSS And Share Point For Developers
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
 
Java server faces
Java server facesJava server faces
Java server faces
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
 
PHP konferencija - Microsoft
PHP konferencija - MicrosoftPHP konferencija - Microsoft
PHP konferencija - Microsoft
 

Viewers also liked

CacharreAndo
CacharreAndoCacharreAndo
CacharreAndo
YcRF
 
Presentación del sistema genesis y portal institucional j a
Presentación del sistema genesis y portal institucional j aPresentación del sistema genesis y portal institucional j a
Presentación del sistema genesis y portal institucional j a
felipegomezg
 
Idocaedro aplicacion
Idocaedro aplicacionIdocaedro aplicacion
Idocaedro aplicacion
Anni Lovee
 
Otsuma(2010727)
Otsuma(2010727)Otsuma(2010727)
Otsuma(2010727)
真 岡本
 
Mantenimiento de computo
Mantenimiento de computoMantenimiento de computo
Mantenimiento de computo
sebassevitas
 
simple present tense
simple present tensesimple present tense
simple present tense
karwinda
 
Shizuoka pref public_library(20101020)
Shizuoka pref public_library(20101020)Shizuoka pref public_library(20101020)
Shizuoka pref public_library(20101020)
真 岡本
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
Niit Care
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Niit Care
 
Presentación1
Presentación1Presentación1
Presentación1
pipe-alejo
 
Jadwal kegiatan ujian smk muhammadiyah 1
Jadwal kegiatan ujian smk muhammadiyah 1Jadwal kegiatan ujian smk muhammadiyah 1
Jadwal kegiatan ujian smk muhammadiyah 1
heri baskoro
 
FEA Final Report - Jawanza Bassue
FEA Final Report - Jawanza BassueFEA Final Report - Jawanza Bassue
FEA Final Report - Jawanza Bassue
Jawanza Bassue
 
High Altitude Research Plane_Jawanza Bassue
High Altitude Research Plane_Jawanza BassueHigh Altitude Research Plane_Jawanza Bassue
High Altitude Research Plane_Jawanza Bassue
Jawanza Bassue
 
Aae oop xp_06
Aae oop xp_06Aae oop xp_06
Aae oop xp_06
Niit Care
 

Viewers also liked (20)

CacharreAndo
CacharreAndoCacharreAndo
CacharreAndo
 
Presentación del sistema genesis y portal institucional j a
Presentación del sistema genesis y portal institucional j aPresentación del sistema genesis y portal institucional j a
Presentación del sistema genesis y portal institucional j a
 
Idocaedro aplicacion
Idocaedro aplicacionIdocaedro aplicacion
Idocaedro aplicacion
 
Otsuma(2010727)
Otsuma(2010727)Otsuma(2010727)
Otsuma(2010727)
 
Mantenimiento de computo
Mantenimiento de computoMantenimiento de computo
Mantenimiento de computo
 
Presentación junio
Presentación junioPresentación junio
Presentación junio
 
simple present tense
simple present tensesimple present tense
simple present tense
 
Shizuoka pref public_library(20101020)
Shizuoka pref public_library(20101020)Shizuoka pref public_library(20101020)
Shizuoka pref public_library(20101020)
 
Mi materia preferida
Mi materia preferidaMi materia preferida
Mi materia preferida
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
159267237 extractos-alquimicos
159267237 extractos-alquimicos159267237 extractos-alquimicos
159267237 extractos-alquimicos
 
Presentación1
Presentación1Presentación1
Presentación1
 
Jadwal kegiatan ujian smk muhammadiyah 1
Jadwal kegiatan ujian smk muhammadiyah 1Jadwal kegiatan ujian smk muhammadiyah 1
Jadwal kegiatan ujian smk muhammadiyah 1
 
FEA Final Report - Jawanza Bassue
FEA Final Report - Jawanza BassueFEA Final Report - Jawanza Bassue
FEA Final Report - Jawanza Bassue
 
High Altitude Research Plane_Jawanza Bassue
High Altitude Research Plane_Jawanza BassueHigh Altitude Research Plane_Jawanza Bassue
High Altitude Research Plane_Jawanza Bassue
 
Aae oop xp_06
Aae oop xp_06Aae oop xp_06
Aae oop xp_06
 
02 penyusunan rpp
02 penyusunan rpp02 penyusunan rpp
02 penyusunan rpp
 
Ki kd tkj kelas x xi dan xii
Ki kd tkj kelas x xi dan xiiKi kd tkj kelas x xi dan xii
Ki kd tkj kelas x xi dan xii
 
Kisi kisi-ujian-nasional-2016-smk 2
Kisi kisi-ujian-nasional-2016-smk 2Kisi kisi-ujian-nasional-2016-smk 2
Kisi kisi-ujian-nasional-2016-smk 2
 

Similar to 03 asp.net session04

03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
Mani Chaubey
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
Niit Care
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
Niit Care
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
Mani Chaubey
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Quek Lilian
 

Similar to 03 asp.net session04 (20)

03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
 
MVC 4
MVC 4MVC 4
MVC 4
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
 
Parallelminds.web partdemo1
Parallelminds.web partdemo1Parallelminds.web partdemo1
Parallelminds.web partdemo1
 
Chapter 09
Chapter 09Chapter 09
Chapter 09
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
ASP.NET OVERVIEW
ASP.NET OVERVIEWASP.NET OVERVIEW
ASP.NET OVERVIEW
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
 
Web tech
Web techWeb tech
Web tech
 
Web techh
Web techhWeb techh
Web techh
 
Web tech
Web techWeb tech
Web tech
 
Web tech
Web techWeb tech
Web tech
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

03 asp.net session04

  • 1. Developing Web Applications Using ASP.NET Objectives In this session, you will learn to: Explain the differences between HTML controls and Web server controls Describe the different types of Web server controls Explain how to use HTML controls and Web server controls Explain how the postback model of ASP.NET 2.0 works Create Web-based user interfaces with HTML controls and Web server controls Write code that interacts with Web server controls Write code that interacts with the postback model of ASP.NET 2.0 Ver. 1.0 Slide 1 of 26
  • 2. Developing Web Applications Using ASP.NET HTML Controls and Web Server Controls HTML Controls: HTML controls are used to add static HTML elements to a Web page. By default, HTML controls are not accessible to the server-side code in the Web page. To enable your server-side code to interact with HTML controls, you must specify that the control runs on the server. Web Server Controls: Web Server controls are .NET Framework objects that are converted by ASP.NET to HTML elements at run time. On receiving a request for a Web page containing Web server controls, ASP.NET : Generates HTML output based on the Web server controls. Returns the HTML output to the browser. Ver. 1.0 Slide 2 of 26
  • 3. Developing Web Applications Using ASP.NET HTML Controls and Web Server Controls (Contd.) Difference between HTML controls and Web server controls: Web Server controls are more versatile than HTML controls if you wish to run server-side code associated with controls. Web Server controls incur more overhead when processing the page as compared to HTML controls. Web Server controls support a rich programming model as compared to their HTML equivalents. Ver. 1.0 Slide 3 of 26
  • 4. Developing Web Applications Using ASP.NET Types of Web Server Controls Visual Studio 2005 groups Web server controls together in the Toolbox, based on their functionality. The various groups of controls are: Standard Controls Data Controls Validation Controls Navigation Controls Login Controls WebPart Controls Ver. 1.0 Slide 4 of 26
  • 5. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) Standard Controls: This group contains controls that provide common user interface elements. Standard controls include: TextBox ListBox Standard Controls DropDownList Checkbox RadioButton Button Image Table Calendar Ver. 1.0 Slide 5 of 26
  • 6. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) Data Controls: This group contains controls used to manipulate data stored in databases, XML files, and other .NET Framework objects. Data controls include: Grid View SqlDataSource Data Controls Ver. 1.0 Slide 6 of 26
  • 7. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) Validation Controls: This group contains controls that are used to validate user input. Simple validation is done on the client side by generating JavaScript code. This reduces the load on the Web server and improves responsiveness. Complex validation is done on the Web server. Validation controls include: RequiredFieldValidator CompareValidator Validation Controls Ver. 1.0 Slide 7 of 26
  • 8. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) Navigation Controls: The controls in this group are used to enable the user to move through the Web site. Navigation controls include: Menu TreeView SiteMapPath Navigation Controls Ver. 1.0 Slide 8 of 26
  • 9. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) Login Controls: The controls in this group are used to create login and sign-up pages for your Web sites. Login controls include: Login ChangePassword PasswordRecovery Login Controls Ver. 1.0 Slide 9 of 26
  • 10. Developing Web Applications Using ASP.NET Types of Web Server Controls (Contd.) WebPart Controls: The controls in this group can be used to build the framework for dynamic Web pages. These controls are typically used in portal-type Web applications. WebPart controls include: WebPartManager WebPartZone Web Part Controls Ver. 1.0 Slide 10 of 26
  • 11. Developing Web Applications Using ASP.NET Working with Web Server Controls Methods for adding Web server controls to Web forms: Drag and drop the control from the Toolbox onto the Design view of the Web page. Drag and drop the control from the Toolbox into the Source view of the Web page. Type the markup text for the control directly into the Source view of the Web page. Ver. 1.0 Slide 11 of 26
  • 12. Developing Web Applications Using ASP.NET Working with Web Server Controls (Contd.) Methods for Setting Web Server Control Properties at Design Time: Select the control in the Design view and set the property values in the Properties window. Select the markup text for the control in the Source view and set the property values in the Properties window. Edit the markup text for the control directly in the Source view of the Web page. Ver. 1.0 Slide 12 of 26
  • 13. Developing Web Applications Using ASP.NET Working with Web Server Controls (Contd.) You can manipulate Web server controls at run time by: Setting a writable property Invoking a method Reading a readable property //Set a writable property Textbox1.Text = “Hello World!”; //Invoke a method TextBox1.Focus(); //Reading a readable property string sName = TextBox1.Text Ver. 1.0 Slide 13 of 26
  • 14. Developing Web Applications Using ASP.NET The ASP.NET 2.0 Page Postback Model Postback model provides a mechanism for: Sending control properties on Web pages from the Web browser to the Web server. Restoring the values when a response is sent back from the Web server to the Web browser. • This model enables Web server controls to retain their values over multiple requests to the server. • It enables you to develop Web pages as if they are part of a stateful application. Ver. 1.0 Slide 14 of 26
  • 15. Developing Web Applications Using ASP.NET The ASP.NET 2.0 Page Postback Model (Contd.) • AutoPostBack Property: • Some Web server controls support the AutoPostBack property. • This property controls whether user interaction with the control should invoke a round-trip request to the server. • EnableViewState Property: This property determines whether the control should retain its state for the duration of the postback. This property should be set to true for those controls whose properties are set in server-side code. Ver. 1.0 Slide 15 of 26
  • 16. Developing Web Applications Using ASP.NET Cross-Page Posting in an ASP.NET Web Page • By default, buttons and other controls that cause a postback on a Web page submit the page back to itself. • Controls can be configured to post to a different target page. • To enable cross-page posting, you need to set the PostBackURL property of a control to the URL of the target page. • To retrieve control values on the submitting page from the target page, you can use the Page.PreviousPage object. • To retrieve the public properties on the submitting page from the target page, you need to include the PreviousPageType directive in the target page as: <%@ PreviousPageType VirtualPath= “~/SourcePage.aspx” %> Ver. 1.0 Slide 16 of 26
  • 17. Developing Web Applications Using ASP.NET Determine How an ASP.NET Web Page Was Invoked A Web page can be invoked in a variety of ways: • By an original request • By a postback • By a cross-page post from another page • By transfer from another page by using the Server.Transfer method • To determine how a page was invoked, you can examine the following properties of the Page object: • Page.IsPostBack: This property is true when page is invoked by a postback page and false otherwise. • Page.PreviousPage: This property contains a reference to the source page when the page is invoked by either a cross page posting or a server transfer. In all other cases, it contains Null. • Page.PreviousPage.IsCrossPagePostBack: This property is true when the page is invoked by a cross page posting. Ver. 1.0 Slide 17 of 26
  • 18. Developing Web Applications Using ASP.NET The Button.OnClientClick Property • Use the Button.OnClientClick property to specify client-side script to be run when the Button object is clicked. • The code that you add to this property is added to the onclick attribute of the control. Ver. 1.0 Slide 18 of 26
  • 19. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls Problem Statement: You are a developer in the Adventure Works organization, a fictitious bicycle manufacturer. You have been asked to assist in the development of the Business-to-Consumer (B2C) Web application and a related Business-to-Employee (B2E) extranet portal. Decisions on the design of the application have already been taken. You have been asked to carry out a number of specific tasks to implement various elements of this design. Ver. 1.0 Slide 19 of 26
  • 20. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls (Contd.) As part of the first phase of the B2C development, you have been asked to complete the prototypes for the following pages: Survey.aspx. You will design a rich graphical user interface for this page that enables users to submit responses to an online survey. You will also add a SiteMapPath control to this page to aid user navigation. SurveyReceipt.aspx. You will design this page to receive the information provided by the user in the Survey.aspx page. FeedbackForm.aspx. You will design this page to receive the information provided by the user in the existing Feedback.aspx page. Default.aspx. You will add a Menu control to this page to aid user navigation. Ver. 1.0 Slide 20 of 26
  • 21. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls (Contd.) You will also add and review a Web.sitemap file that will be used to add navigation features to the Web application. Additionally, you will add and review an advertising schedule file that will be used to add dynamic image display features to the Web application. Ver. 1.0 Slide 21 of 26
  • 22. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls (Contd.) Solution: • To solve this problem, you need to perform the following tasks: 1. Build the Graphical User Interfaces with HTML Controls a. Review the proposed design of the Survey.aspx page. b. Open the Adventure Works Web site. c. Define the Survey.aspx page layout by using HTML controls in Design view. d. Define the Survey.aspx page layout by modifying HTML markup in Source view. e. Add HTML Input controls to the Web page. Ver. 1.0 Slide 22 of 26
  • 23. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls (Contd.) 1. Build Graphical User Interfaces with Web Server Controls • Review the proposed design of the Survey.aspx page. • Refine the Survey.aspx page layout by using an ASP.NET Table Web server control in Design view. • Modify the properties of the Table Web server control. • Add rows to the Table Web Server control by using Source view. • Add a nested Table Web server control in Source view. • Add Web server controls to the Table control. • Add site navigation functionality by using Web server controls. • Incorporate advertising functionality with Web server controls. Ver. 1.0 Slide 23 of 26
  • 24. Developing Web Applications Using ASP.NET Demo: Adding and Configuring Server Controls (Contd.) 1. Program Web Server Controls and Work with Postbacks • Manage the Click event for the ImageMap object. • Create the OnClientClick property and the server-side Click event for the Submit button. • Determine if an ASP.NET Web page was invoked as part of the postback process. • Create a page that can receive and process information submitted as part of a cross-page postback. • Test the Web application. Ver. 1.0 Slide 24 of 26
  • 25. Developing Web Applications Using ASP.NET Summary In this session, you learned that: HTML controls are representations of HTML markup which are not accessible to the server side code. Web server controls are .NET Framework objects that are converted by ASP.NET to HTML elements at run time. Visual Studio 2005 provides many groups of Web server controls based on their functionality, such as Standard Controls and Data Controls. You can add Web server controls to Web forms from the Toolbox or by typing markup text. You can set Web server control properties at design time as well at run time. The ASP.NET postback model is designed to provide stateful rendering of dynamic content on a Web page. Ver. 1.0 Slide 25 of 26
  • 26. Developing Web Applications Using ASP.NET Summary (Contd.) • The Page object exposes the IsPostBack property that you can use to determine how a page was invoked. • You can configure the controls to post to a different target page referred to as cross-page posting. • When a page is invoked by another page, you can retrieve control values and public properties of the invoking page from the invoked page. Ver. 1.0 Slide 26 of 26

Editor's Notes

  1. Show all the controls using visual studio and discuss the use of few controls.
  2. Show all the controls using visual studio and discuss the use of few controls.
  3. Show all the controls using visual studio and discuss the use of few controls.
  4. Show all the controls using visual studio and discuss the use of few controls.
  5. Show all the controls using visual studio and discuss the use of few controls.
  6. Show all the controls using visual studio and discuss the use of few controls.
  7. Show all the controls using visual studio and discuss the use of few controls. Discuss HTML Server conrols
  8. Web Server controls are automatically configured with the runat=&amp;quot;server&amp;quot; attribute, so there is no need to convert them as there is for HTML server controls. Edit the ID attribute that Visual Studio automatically assigns.
  9. Show the demo by performing each step to set Web server control properties Explain by example how to manipulate Web server control (refer SG)
  10. Show the demo by performing each step to set Web server control properties Explain by example how to manipulate Web server control (refer SG)
  11. FAQ Explain the HTTP is state less protocol it does not store any reference of previous request even with the same user. Server has to maintain such information pragmatically. Explain how round trip processing maintain this state.
  12. Explain with example of ListBox and DropDownList control given SG in Auto Postback Discuss when we set EnableViewState Property to true Explain the difference between postback on self page and postback on crosspage
  13. Explain what is server transfer invocation what is Original Request invocation Show the use of these properties by using the example given in SG.
  14. Explain what is server transfer invocation what is Original Request invocation Show the use of these properties by using the example given in SG.
  15. Explain what is server transfer invocation what is Original Request invocation Show the use of these properties by using the example given in SG.