从ASP.NET更改CSS样式code [英] Changing CSS style from ASP.NET code

查看:261
本文介绍了从ASP.NET更改CSS样式code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能重复:结果
  更改CSS动态


我需要从ASP.NET code(VB)改变一个div容器(CSS属性height)的高度。

我怎么能这样做?


解决方案

C#,因为我不想错字VB的语法。

标记:


 < D​​IV =服务器ID =divControl> ...< / DIV>


页面级别:


 保护System.Web.UI.HtmlControls.HtmlGenericControl divControl;


的OnLoad /其它功能:


  divControl.Style.Add(高度,数/ anotherNumer);


Possible Duplicate:
Change CSS Dynamically

I need to change the height of a div container(CSS Property Height) from ASP.NET code (VB).

How can I do that?

解决方案

C#, because I don't want to typo the VB syntax.

Markup:

<div runat="server" id="divControl">...</div>

Class of the Page:

protected System.Web.UI.HtmlControls.HtmlGenericControl divControl;

OnLoad/Other function:

divControl.Style.Add("height", number / anotherNumer);

这篇关于从ASP.NET更改CSS样式code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆