Jan
10
2007
HeadermanagerControl - step 1 master page
Posted by admin under
ASPCodeHeaderManager
This example is what you get in the download. I will try to guide you though it so you get an understanding of the control.
We have a master page - master.master - and two pages (page1.aspx and page2.aspx).
Now - lets start with master.master:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" EnableViewState="false" %>
<%@ Register TagPrefix="headermanager" Namespace="ASPCodeHeaderManager" Assembly="ASPCodeHeaderManager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<headermanager:ASPCodeHeader ID="whatever" runat="server">
<IncludeScripts>
<headermanager:IncludeScript Path="scripts/hello.js" />
</IncludeScripts>
<MetaData>
<headermanager:MetaData Name="keywords" Content="hello, there2" />
<headermanager:MetaData Name="description" Content="Jojamenjavisst" />
</MetaData>
<IncludeStylesheets>
</IncludeStylesheets>
</headermanager:ASPCodeHeader>
...
As you can see we have here included the <headermanager:ASPCodeHeader> control.
Lets start with <IncludeScripts>.
<headermanager:IncludeScript Path="~/scripts/hello.js" />
means that (since we are in the master page) - all pages will get a <script type="text/javascript" src="/www/scripts/hello.js"></script> injected into the <header> part.
Further on we define some meta tags. Meta tags possible to override in the specific pages - I will come to that later.
As for stylesheets we havn't defined any global (used on all pages) of those - but it works just like IncludeScripts.