您如何以编程方式将CSS类应用于字符串变量? [英] How do you programmatically apply a css class to an string variables?
本文介绍了您如何以编程方式将CSS类应用于字符串变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式将CSS类应用于字符串变量?
例如,
string something ="
How do you programmatically apply a css class to an string variables?
for example,
string something="
string something="
why?..........
推荐答案
如果您想使用Code-behind将CSS应用于控件,请尝试此
If you want to apply CSS for controls using Code-behind then try this
<asp:panel id="Panel1" runat="server" xmlns:asp="#unknown">
Hello World
</asp:panel>
Panel1.CssClass = "PanelStyle";
或
or
Panel1.Attributes.Add("class", "PanelStyle");
您不能这样做.
CSS用于控制控件的样式(不是变量).
设置变量的样式没有任何意义.
You cannot do so.
CSS is for styling controls (not variables).
Styling a variable makes no sense.
将此字符串放入某些控件DIV,Label中,并在运行时设置css.:)
put this string in some control DIV,Label and set css on runtime.:)
这篇关于您如何以编程方式将CSS类应用于字符串变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文