如何获得在背后asp.net code CSS样式 [英] How to get css styles in code behind asp.net
本文介绍了如何获得在背后asp.net code CSS样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从code CSS样式在asp.net C#的背后,都没有发现在网络上的解决方案,它是可以直接从styles.css的文件中获取它,或者我需要解决方法吗?
I need to get css styles from code behind in asp.net c#, haven't found solution on the web, is it possible to get it directly from styles.css file or do I need to workaround?
我使用的主题在我的web应用程序,但我也需要做一些服务器处理,我需要从CCS的文件,这是当然的每个用户不同的颜色:■
I'm using themes in my web app, but I also need to do some server processing and I need colours from ccs files, which are different for each user of course:s
推荐答案
铯文件
protected void Button1_Click(object sender, EventArgs e)
{
Panel1.CssClass = "RedBackground";
Panel1.Style.Add("font-size", "200%");
/// get value back
string pvalue = Panel1.Attributes["class"] ;
or
btn_4.Attributes.CssStyle["property"]
}
HTML文件
<style type="text/css">
.RedBackground
{
background-color: Red;
}
<asp:Panel ID="Panel1" runat="server">
Hello
</asp:Panel>
这篇关于如何获得在背后asp.net code CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文