jQuery链接在asp.net内容页面中不起作用
问题描述:
当我在普通的aspx页面中使用以下链接标记时,它工作正常.
但是当我在母版的内容页面中使用它时,它不起作用.
有什么问题?我应该把它放在哪里?
When I use following link tag in normal aspx page, it is working fine.
But when I used it in content page of master, it''s not working.
What''s the problem? Where I should keep it?
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
谢谢
答
您应该在母版页本身中包含该link
标记.如果要在内容页面上执行此操作,则需要通过代码添加.
You should include thatlink
tag in master page itself. If you want to do it with content page, you need to add it via code.
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
IMO,您应该将link
标记放在head
内的母版页中.
IMO, you should place your link
tag in master page within head
.
理想情况下,所有此类引用都应添加到 MasterPage的head
标记中.
下面的链接将为您提供更多信息.
从ASP.NET母版页和内容页调用JavaScript-第I部分
Idealy all these kind of refernces should be added tohead
Tag of MasterPage.
Below link will give you more information.
Calling JavaScript from ASP.NET Master Page and Content Pages - Part I