动态载入样式连接文件
Public Shared Sub AddStyleSheet(ByVal page As Page, ByVal cssPath As String)
Dim link As New HtmlLink()
link.Href = cssPath
link.Attributes("rel") = "stylesheet"
link.Attributes("type") = "text/css"
page.Header.Controls.Add(link)
End Sub
动态载入脚步文件,并解释路径
Public Shared Sub LoadCss(ByRef page As System.Web.UI.Page)
Dim script As New HtmlGenericControl("script")
script.Attributes.Item("type") = "text/javascript"
script.Attributes.Item("src") = page.ResolveUrl("~/js/LoadCss.js")
script.Attributes.Item("id") = "LoadCssFrom_" + page.ResolveUrl("~")
page.Header.Controls.Add(script)
End Sub
showModalDialog时使postback本页
Public Shared Sub AddBaseSelf(ByRef page As System.Web.UI.Page)
Dim bs As New HtmlGenericControl("base")
bs.Attributes.Item("target") = "_self"
Page.Header.Controls.Add(bs)
End Sub
禁止页面缓存
Public Shared Sub StopPageBuff(ByRef page As System.Web.UI.Page)
page.Response.BufferOutput = True
page.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1)
page.Response.Expires = 0
page.Response.CacheControl = "no-cache"
'page.Response.AddHeader("Cache-Control", "no-cache, must-revalidate")
End Sub