从代码后面调用CSS样式表 [英] call css stylesheet from code behind
本文介绍了从代码后面调用CSS样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
从myFile.aspx.vb调用CSS类时遇到问题
没有提示任何错误信息...
只是我不希望出现在网页中的图片.
以下是我的项目的代码:
myFile.aspx.vb
Hi there,
I had problem when when call css class from myFile.aspx.vb
there is not prompt any error message...
just the picture that i want not appear in web page.
below is the code for my project:
myFile.aspx.vb
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
_oPortalInfo = PortalInfo.GetCurrentPortalInfo
DataUtil.InitDataHelper(_oDal, _oPortalInfo.DataAccess.UserId,
_oPortalInfo.DataAccess.Password, _oPortalInfo.DataAccess.SecId)
CheckLinks()
If Not IsPostBack Then
LoadTab()
End If
End Sub
Private Sub LoadTab()
'load from database
_Tabs = New StringBuilder
End Sub
Private Sub AddTab(ByVal Text As String, ByVal ProfileNr As String)
_Tabs.Append(class=""eviewButtonImage"")
End Sub
myCssFile.css
.eviewButtonImage{
background-image:url('myImage.gif')
}
有什么事吗请,我真的需要您的帮助.
Is it anything wrong? please,i really need your help.
推荐答案
在代码中添加样式表的方式看起来不正确.
应该是这样的:
The way you have added the stylesheet in code behind does not look correct.
It should be something like:
lblText.Attributes.CssStyle.Add("background-color", ddBGColor.SelectedValue)
请参阅此文章以获取详细信息:
http://www.vbasic.net/detail.aspx?tid=141 [ ^ ]
Please refer this article for full detail:
http://www.vbasic.net/detail.aspx?tid=141[^]
这篇关于从代码后面调用CSS样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文