Presentation is loading. Please wait.

Presentation is loading. Please wait.

User Controls MacDonald pp. 381-386 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Similar presentations


Presentation on theme: "User Controls MacDonald pp. 381-386 MIS 324 MIS 324 Professor Sandvig Professor Sandvig."— Presentation transcript:

1 User Controls MacDonald pp. 381-386 MIS 324 MIS 324 Professor Sandvig Professor Sandvig

2 Outline What are User Controls FeaturesImplementation Basic Basic Passing parameters Passing parametersExample Compared to PHP include() Summary

3 What are User Controls? Reusable UI code Classes User Controls Code Interface ReusabilityModularityEncapsulation

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

5 Implementation File extension:.ascx Register user control on.aspx page Page directives Page directives Initialize in code render block Similar to web controls Similar to web controls Pass parameters in as properties 1.In code render block myHeading=“Featured Product” 2.Programatically: ucLeftMenu.Heading = “Featured Product”

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

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

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


Download ppt "User Controls MacDonald pp. 381-386 MIS 324 MIS 324 Professor Sandvig Professor Sandvig."

Similar presentations


Ads by Google