Error when using link href inside my ContentPlaceH

2019-07-09 03:16发布

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?

1条回答
老娘就宠你
2楼-- · 2019-07-09 03:58

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
查看更多
登录 后发表回答