如何动态地应用样式表 [英] How to apply style dynamicaly a table
本文介绍了如何动态地应用样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Table_ID.Style.Add("CssClass", "sel_tbl");
}
}
protected void btn_find_Click(object sender, EventArgs e)
{
Table_ID.Style.Add("CssClass", "selecttable_style_new");
}
它不执行
It , does't perform
推荐答案
参考此事;
http://www.aspsnippets.com/Articles/Dynamically-change-switch-CSS-file-programmatically-from-code-behind- in-ASPNet.aspx [ ^ ]
您可以使用javascript和jquery动态设置CSS
Javascript
You can set css dynamically using javascript and jquery
Javascript
document.getElementsByClassName("tableID").ClassName = "ClassName";
Jquery
Jquery
( #TableID)。addClass( className);
("#TableID").addClass("className");
这篇关于如何动态地应用样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文