1 / 8

User Controls MacDonald pp. 381-386

User Controls MacDonald pp. 381-386. MIS 324 Professor Sandvig. Outline. What are User Controls Features Implementation Basic Passing parameters Example Compared to PHP include() Summary. What are User Controls?. Reusable UI code. Classes. Code. Reusability Modularity

garth
Download Presentation

User Controls MacDonald pp. 381-386

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. User ControlsMacDonald pp. 381-386 MIS 324 Professor Sandvig

  2. Outline • What are User Controls • Features • Implementation • Basic • Passing parameters • Example • Compared to PHP include() • Summary

  3. What are User Controls? • Reusable UI code Classes Code • Reusability • Modularity • Encapsulation Interface User Controls

  4. Features • Syntax similar to .aspx page • Script tags • Page events • Reusability • Use in many .aspx page • Header, footers menus • Caching • Allows to cache parts of a page • Nesting • User controls can call other user controls

  5. Implementation • File extension: .ascx • Register user control on .aspx page • Page directives • Initialize in code render block • Similar to web controls <myControl:Menu id=“ucLeftMenu” runat=“server” /> • Pass parameters in as properties • In code render block myHeading=“Featured Product” • Programatically: ucLeftMenu.Heading = “Featured Product”

  6. Implementation • Control Properties • Create Class Property • Get & Set • Displayed by Intellisense • See handout

  7. Implementation • Examples: • Application: MIS 324 web site • Buttons, content, search, quotes, weather • SSI for header and footer, groups of buttons • Syntax: output (source) • Moving data between .aspx & .ascx • In: No problem • Out: • Timing is an issue • Creates undesirable dependency • Solution: handle events inside .ascx

  8. Summary • Benefits of User Controls • Reusable UI code • Encapsulation • Compartmentalize functionality • Pass in properties • Fire own set of page events • Use to fill controls from data source • Capture control events • Caching • Easy to use

More Related