Page 163 - DCAP312_WEB_TECHNOLOGIES_II
P. 163

Unit 8: Creating More Advanced ASP.NET



            Limitations of User Controls in ASP.NET?                                              Notes
            As the user controls are not compiled into assemblies, they have the following limitations:
               1.  A copy of the control must exist in each Web application project in which the control is
                 used.
               2.  User  controls  cannot be loaded  in the Visual Studio  .NET  Toolbox;  instead,  you must
                 create them by dragging the control from Solution Explorer to the Web form.
               3.  User control code is initialized after the Web form loads, which means that user control
                 property values are not updated until after the Web form’s Load event.
            Advantages of Using User Controls in ASP.NET:
               1.  User controls give more functionality than the ordinary controls since you can combine
                 the other controls to create user controls. User controls can be created that are specific to
                 the application that you create.

               2.  So you can add unique functionalities to the control. These user controls are easy to add to
                 any web page once you created. So there is no need to code again for the same functionality
                 if it is used in another page of the web application. It is also possible to convert the whole
                 web pages into a user control with some minor modifications and use it anywhere.
               3.  By using the user control for some functionality you can separate the design work and
                 the back-end work so that you can engage your design and coding team separately and
                 efficiently.

               4.  If you use user control the development is modularized which means you have different
                 functionalities available by using just a simple tag in your web page. This speeds up the
                 development process.
                          When you develop a custom server control, you must include it in a namespace.
                          If you do not, it will not be accessible from an ASP.NET page.

            Self Assessment Questions
            Multiple Choice Questions

               1.  ………………….. are one of the things that make developing with ASP.NET.
                 (a)  Privatization              (b)  Page level
                 (c)  Server controls            (d)  None of these.
               2.  We may use data binding to fill lists with selectable items from an ……………
                 (a)  program interface          (b)  paging

                 (c)  XML program                (d)  imported data source
               3.  Each selectable item in a List Box control is defined by a………………..
                 (a)  listItem element           (b)  markup language
                 (c)  encapsulation              (d)  synchronization
               4.  ……………….requirements as close as possible in a data model.

                 (a)  ordered collection         (b)  real-world data
                 (c)  collaborate                (d)  Infrastructure
            True or False
               5.  User controls can be loaded in the Visual Studio.

                 (a)  True                       (b)  False


                                             LOVELY PROFESSIONAL UNIVERSITY                                   157
   158   159   160   161   162   163   164   165   166   167   168