views:

654

answers:

1

I am using a MasterPage in my project...

This this the link i need to place inside my ContentPlaceHolder of my Dedault.aspx page

<link href="jquery/imagebox/imagebox.css" rel="stylesheet" />

But i get a error "Element link cannot be nested within element td"

Any idea what to do?

+3  A: 

You can only place stylesheet links in the header of the document. Here's a link how to do that from a ContentPlaceholder:

http://www.odetocode.com/articles/450.aspx

Quote:

Protected Sub Page_Load(ByVal sender As Object, _
                         ByVal e As System.EventArgs)

   Dim cssLink As New HtmlLink()
   cssLink.Href = "~/styles.css"
   cssLink.Attributes.Add("rel", "stylesheet")
   cssLink.Attributes.Add("type", "text/css")
   Header.Controls.Add(cssLink)

End Sub
Mladen Mihajlovic
Then where must i place it? Because i cant use a header in my Default.aspx page since i am using MasterPages.
Etienne
Seems you can actually - I amended my answer :)
Mladen Mihajlovic
@Etienne - you can use contentplaceholders in "head" element too.
TcKs
@TcKs - what will the syntax be for that?
Etienne
@Mladen - thanks it does work, but it placed the link inside my actual MasterPage and because of this it does not work for me. For some reason it must be at the Default.aspx level.
Etienne
If I understand correctly it placed it in the HEAD tag of which you have only one (the masterpage creates it) so it can only put it there. You cannot link to a style outside it. Why would you want to?
Mladen Mihajlovic