Error when using link href inside my ContentPlaceHolder

最后都变了- 提交于 2019-12-11 01:04:13

问题


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:


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


来源:https://stackoverflow.com/questions/722588/error-when-using-link-href-inside-my-contentplaceholder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!