Page 48 - DCAP312_WEB_TECHNOLOGIES_II
P. 48

Web Technologies-II                                            Sarabjit Kumar, Lovely Professional University



                   Notes                             Unit 3: Server Controls Basic



                                   CONTENTS

                                   Objectives
                                   Introduction
                                   3.1  PostBack
                                       3.1.1   AutoPostBack Property in ASP.NET
                                       3.1.2   Life Cycle of a Web Page
                                   3.2   Data Binding
                                       3.2.1   Properties of Data Binding

                                   3.3   Web Server Controls
                                       3.3.1   Generalities of ASP.NET Server Controls
                                       3.3.2   Identifying a Server Control
                                       3.3 3   Naming Containers
                                       3.3.4   Themeable Controls
                                       3.3.5   Control State

                                   3.4  Summary
                                   3.5  Keywords
                                   3.6   Review Questions
                                   3.7   Further Reading

                                 Objectives

                                 After studying this unit, you will be able to:

                                    •  Define postback
                                    •  Explain data binding
                                    •  Understand web server controls

                                 Introduction


                                 HTML server controls are HTML elements containing attributes to create them noticeable to
                                 and programmable on the server. By default, HTML elements on a Web Forms page are not
                                 accessible to the server; they are treated as opaque text that is passed through to the browser.
                                 However, by converting HTML elements to HTML server controls, we expose them as elements
                                 we can program on the server. The object model for HTML server controls maps closely to that
                                 of  the  corresponding  elements.  For  example,  HTML  attributes  are  exposed  in  HTML  server
                                 controls as properties.
                                 Any HTML element on a page can be converted to an HTML server control. Conversion is a
                                 simple process involving just a few attributes. As a minimum, an HTML element is converted
                                 to  a  control  by  the  addition  of  the  attribute  RUNAT=  “SERVER”.  This  alerts  the  ASP.NET
                                 page framework during parsing that it should create an instance of the control to use during
                                 server-side page processing. If we want to reference the control as a member within our code,
                                 we should also assign an ID attribute to the control.

        42                                LOVELY PROFESSIONAL UNIVERSITY
   43   44   45   46   47   48   49   50   51   52   53