c# - Header equivalent of PHP include -


i come php , have started asp/.net. aware direct equivalent of include("filename.php"); not exist, that's not want achieve.

i attempting create header file can use on every page. have read many sources making user control solution. after creating of necessary code make work, arrived @ point actual element on page isn't created @ point when call .innerhtml. example:

breadcrumbcontainer.innerhtml = "testing text"; 

the above code not work when called within file called header.ascx.cs though there div on page runat="server" , correct id.

i trying find out if there easier way resolve problem. have been told should avoid masterpages (even though don't know if relevant in situation). should create sort of method creates html header, way can call on every page? there other solutions haven't thought of?

if there articles explain problem, love links. have literally searched hundreds of pages on web , found nothing giving me clear understanding of how resolve problem.

master pages can relevant , helpful in case. check out them out.!

when says "don't something" ask why. not take such advice @ face value. that's how phantom fears spread , thousands of developers end of treating programmer's pet peeve an absolute rule! besides, asking "why?" strengthen own more senior developer's understanding of issue @ hand.

from link:

asp.net master pages allow create consistent layout pages in application. single master page defines , feel , standard behavior want of pages (or group of pages) in application. can create individual content pages contain content want display. when users request content pages, merge master page produce output combines layout of master page content content page.


Comments