link attribute

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
 
K

Karl Seguin [MVP]

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
 
S

simonZ

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]...
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top