Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 6962: Server-side Design and Programming Master Pages.

Similar presentations


Presentation on theme: "CSCI 6962: Server-side Design and Programming Master Pages."— Presentation transcript:

1 CSCI 6962: Server-side Design and Programming Master Pages

2 ASP and CSS Implemented as a theme Create App_Themes directory Create subdirectory with stylesheet name Copy stylesheet into subdirectory Copy other resources (images, etc.) into subdirectory

3 ASP and CSS Setting style for all pages: Add to web.config Setting style for individual page: Add to <page tag

4 ASP Master Pages Framework that allows other pages to be displayed inside of them as content Master page Content

5 Creating Master Pages Option in “New Item” List

6 Master Page Contents Defines content common to all pages –Logo, navbar, etc. Can include dynamic content –Example: Current date

7 Placeholder for Contents Must contain a ContentPlaceHolder object –Where content from other pages will be inserted –Two automatically added when Master Page created –Can always add more

8 Linking Content Pages Can link existing content page to master page using Master Page property of page Check “Select Master Page” when adding new page –Can do later, but must strip out any html, body, form, and div tags

9 Creating Content Pages New page appears inside master page in editor –Appears at location of ContentPlaceHolder –Master page content cannot be edited

10 Creating Content Pages Page contents appear inside <asp:Content tag

11 Creating Content Pages When run in browser, content page rendered inside master page

12 Multiple Content Areas Can insert multiple ContentPlaceHolder on master page Specify what goes in each area in content page

13 Nested Master Pages Can nest one master page inside another –Outer = general content to all pages –Inner = specific content to some pages –As with content page, prompted for outer master page

14 Nested Master Pages In editor, drawn inside outer master page in its ContentPlaceHolder Must have own ContentPlaceHolder to insert content from its client pages

15 Nested Master Pages Specify inner master page as master page Content rendered inside inner master page Inner master page rendered inside outer master page

16 Accessing Master Page Controls Client page can manipulate master page elements –More difficult, since not same object Basic steps: –Make master page control public to client page Create public method in code behind to manipulate control –Set VirtualPath directive in client to refer to master page

17 Accessing Master Page Controls Example: –User enters name in content page –Greeting with name appears in master page


Download ppt "CSCI 6962: Server-side Design and Programming Master Pages."

Similar presentations


Ads by Google