Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. asp.net equivalent of php's 'Include'

asp.net equivalent of php's 'Include'

Scheduled Pinned Locked Moved ASP.NET
csharpphphtmlasp-netcom
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gvanto
    wrote on last edited by
    #1

    I was wondering if there's an equivalent 'include'-type method for asp.net pages (like php's include "incFolder/header.php" which includes the header on each page). I have a master page, with a contentPlaceHolder (CPH). In the CPH, I load each page. However, there's a section of (html) code that I'd like to be able to include at certain places WITHIN the CPH (ie. the individual pages). Can individual pages also reference some sort of cph's themselves? (this would be awesome). Scenario: - - - - - - masterPage.master: asp: contentplaceholder id=myCPH . . . . asp: contentplaceholder - - - - - - - - - - - - - - - - MyCPH: **Hello world this is my page** HERE I want to include a generic block of code to be used in individual CPH's more myCPH stuff...blah blah blah... - - - - - - - - - - - - - - - - - Any help much appreciated, Gerry aps.net newbie

    Learn How to Make $ With Domains http://www.dntutor.com

    P 1 Reply Last reply
    0
    • G gvanto

      I was wondering if there's an equivalent 'include'-type method for asp.net pages (like php's include "incFolder/header.php" which includes the header on each page). I have a master page, with a contentPlaceHolder (CPH). In the CPH, I load each page. However, there's a section of (html) code that I'd like to be able to include at certain places WITHIN the CPH (ie. the individual pages). Can individual pages also reference some sort of cph's themselves? (this would be awesome). Scenario: - - - - - - masterPage.master: asp: contentplaceholder id=myCPH . . . . asp: contentplaceholder - - - - - - - - - - - - - - - - MyCPH: **Hello world this is my page** HERE I want to include a generic block of code to be used in individual CPH's more myCPH stuff...blah blah blah... - - - - - - - - - - - - - - - - - Any help much appreciated, Gerry aps.net newbie

      Learn How to Make $ With Domains http://www.dntutor.com

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      If it is only to be used in certain pages, then you could encapsulate it in a web user control and include that control where required.

      G 1 Reply Last reply
      0
      • P Paddy Boyd

        If it is only to be used in certain pages, then you could encapsulate it in a web user control and include that control where required.

        G Offline
        G Offline
        gvanto
        wrote on last edited by
        #3

        hi Paddy, Thanks but its only a bit of html (the page's footer) which I'd like to be easily update-able by changing the code in only one place rather than on every page... Is this what a web user control achieves? many thanks, gerry

        Learn How to Make $ With Domains http://www.dntutor.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups