如何以编程方式检索 HTML 服务器控件的样式?
假设我有
;标签 id="toggleText" & runat="Server"
然后我可以使用以下命令更改样式属性 -toggleText.Style.Add("Display", "block");
但如果我想检索样式属性那么该怎么做?
谢谢
Suppose i'm having <div> tag with id="toggleText" & runat="Server"
then i can change style attributes by using following -
toggleText.Style.Add("Display", "block");
But if i want to retrieve the style attribute then how to do this?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简单的:
Easy:
当您查询控件的 Style 属性 您将获得“应用于 ASP.NET 文件中指定 HTML 服务器控件的所有级联样式表 (CSS) 属性的集合” - 该页面上还有一个代码示例。
When you query the control's Style property you get "a collection of all cascading style sheet (CSS) properties applied to a specified HTML server control in the ASP.NET file" - there's a code sample on that page as well.