修改/编辑并保存在.CSS文件中使用ASP.NET [英] Modify/Edit and Save in .CSS file Using ASP.NET
问题描述
大家好,
是否可以在运行时编辑或修改 .css
文件并保存在.css文件中?
我的意思是,我的样式表(Default.css)的类名为changeLabelcolor。我想在运行时在.css类中进行更改。
Hi all,
Is it possible to edit or modify .css
file at run time and save in the .css file?
I mean, i have style sheet(Default.css) with a class name changeLabelcolor. I want to make change in .css class at run time.
.changeLabelcolor
{
background-color: Grey;
}
如果我在后面的代码中将背景颜色从灰色更改为蓝色,那么它将进行更改永久更改标签
类。
我为此做了什么?
if i change the background-color from "Grey" to "Blue" in my code behind then it will make change changeLabelcolor
class permanently.
What I do for this?
推荐答案
查看这些链接
ASP.NET中的动态CSS样式:灵活的方法 [ ^ ]
使用CSS并动态更改它们ASP.NET& C# [ ^ ]
问候..
See these links
Dynamic CSS Styling in ASP.NET: A Flexible Approach[^]
Using CSS and Changing them Dynamically ASP.NET & C#[^]
Regards..
您可以参考以下内容。
1. 使用ASP.Net制作动态CSS内容 [< a href =http://cfouquet.blogspot.in/2006/06/making-dynamic-css-content-with-aspnet.html\"target =_ blanktitle =New Window> ^ ]
2. 在asp.net中动态加载CSS元素 [ ^ ]
You can refer the following.
1. Making Dynamic CSS content with ASP.Net[^]
2. Dynamically loading CSS elements in asp.net[^]
在aspx页面中有这样的东西使用ID和runat =server标签,然后更改直接在服务器端设置href的属性。
In aspx page when you have something like this with ID and runat="server" tags then you change set the attribute for href directly in server side.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="title" %>
<link href="~/Styles/Default.css" rel="stylesheet" type="text/css" id="stylesheet" runat="server" />
在服务器端,您调用添加代码
In server side you call add the code
protected void Page_Load(object sender, EventArgs e)
{
//updates the stylesheet's href
stylesheet.Attributes["href"] = "Newstyle.css";
//stylesheet.Attributes["href"] = s;
}
如果您想在运行时编辑css文件,请参阅此链接
http://stackoverflow.com/questions/1637934/是否可以编辑或修改css文件在运行时间 [ ^ ]
这篇关于修改/编辑并保存在.CSS文件中使用ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!