C# 在后面的代码中设置显示属性

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1471141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 17:52:45  来源:igfitidea点击:

setting display property in the code behind

c#asp.net

提问by Sumeru Suresh

How can i set the display property to block in the code behind?

如何将 display 属性设置为阻止后面的代码?

<asp:Panel ID="pnlHedgingTypeI"  Style="display:none" runat="server">

pnl.Attributes.Add("display", "block");  

is not helping me ..Could you please help me to resolve this?

没有帮助我..你能帮我解决这个问题吗?

回答by Sumeru Suresh

pnl.Attributes.Add("style", "display:block");is correct ... got it.

pnl.Attributes.Add("style", "display:block");是对的……明白了。

回答by rahul

You can also do

你也可以这样做

pnl.Style["display"] = "block";

回答by Canavar

Try this :

尝试这个 :

pnl.Style.Add("display", "block");