[英]How do I apply a stylesheet on page leave in asp.net?
I'm new to asp.net and don't know if this is possible. 我是asp.net的新手,不知道是否可行。
My goal is that if the client is leaving a certain page "current page" that a specific style sheet would be applied on a master-page (which would be for every other page on the site). 我的目标是,如果客户离开某个页面“当前页面”,则特定样式表将应用于母版页(适用于网站上的其他所有页面)。
I would think it would be something like... 我想那会是...
I should note- all the links on the current page are regular links. 我应该注意-当前页面上的所有链接都是常规链接。 I'd like to accomplish this without changing each link to an asp control.
我想在不更改每个链接到asp控件的情况下完成此操作。
Any help is greatly appreciated. 任何帮助是极大的赞赏。
Thanks! 谢谢!
I think if you used the url /default.aspx?css=1 or whatever, then you can use something like 我认为,如果您使用网址/default.aspx?css=1或其他任何方式,那么您可以使用类似
if request.querystring("css") = 1 then
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 if
I haven't tried this or anything but should be ok. 我还没有尝试过任何方法,但是应该没问题。
Similar if you use 如果使用类似
session("css") = "1"
when you click the link.. 当您单击链接时。
if session("css") = 1 then...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.