你如何修改样式文件后面code在ASP.net的div? [英] How do you modify style in the code behind file for divs in ASP.net?

查看:104
本文介绍了你如何修改样式文件后面code在ASP.net的div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正尝试修改的基础上,我从一个数据库表中获取我的aspx页面背后的code中的信息的div CSS样式属性。简化形式以下基本上是什么,我试图做的,但我得到的错误。

下面是我的code:

ASPX:

 < D​​IV ID =testSpace=服务器>
    测试
< / DIV>

code背后:

  testSpace.Style =显示:无;
testSpace.Style(显示)=无;

任何帮助将是AP preciated。谢谢!


解决方案

  testSpace.Style.Add(显示,无);

Currently I am trying to modify a css style attribute for a div based on the information I get from a database table in the code behind of my aspx page. In simplified form the following is essentially what I am trying to do but I get errors.

Here is my code:

ASPX:

<div id="testSpace" runat="server">
    Test
</div>

CODE BEHIND:

testSpace.Style = "display:none;"    
testSpace.Style("display") = "none";

Any help would be appreciated. Thanks!

解决方案

testSpace.Style.Add("display", "none");

这篇关于你如何修改样式文件后面code在ASP.net的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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