link attribute

  • Thread starter Thread starter simonZ
  • Start date Start date
S

simonZ

I would like to add this attribute to content page:

<link rel="stylesheet" media="print" title="Printer-Friendly Style"
type="text/css" href="printStyle.css">

This attribute should be putted into the header of the page.

Since my content page has master page and header is only at the master page,
I should put this attribute to the header of a master page.

But then it will be visible to all content pages with this master page, what
I don't wan't to.

Any idea?

regards,S
 
add a literal to the head:

<head>
<asp:literal id="StyleSheetContainer" runat="Server" />
</head>

expose it as a property:

<script runat="server">
publc ReadOnly Property HeadContainer() As Literal
Get
Return StyleSheetContainer
End Get
End Property
</script>

Sepcify the type of your master page in your page:
<%@ MasterType VirtualPath="~/MasterPage.master" %>


Access the attribute from your page's codebehind:
Master.HeaderContainer.Text = "<link..."

Karl
 
Hi, Karl,

you can't add literal control into a head section of the page. You get an
error:

unrecognized namespace: asp

Any other idea?

regards,S

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
 
You can add a theme to the web site (for instance naming it
"Printable"), put the css file in the theme folder, and add
Theme="Printable" to the @Page directive. This will add a link tag for
the css file to the head of the page.
 
Back
Top