【问题标题】:How can I add style to div in asp.net code behind without runat="server"如何在没有 runat="server" 的情况下在 asp.net 代码中为 div 添加样式
【发布时间】:2018-10-28 06:39:28
【问题描述】:

我想在没有 runat="server" 的情况下设置 div 样式,但我不知道该怎么做。

 <div class="form-horizontal" id="editQuestionForm"> 
</div>

【问题讨论】:

  • &lt;div class="form-horizontal" id="editQuestionForm" style="{your style here}"&gt; => 这是你想要的吗?

标签: css asp.net visual-studio


【解决方案1】:

您可以在后面的代码中使用受保护的变量并从您的代码中设置该变量。

例如 - 在代码后面 (.aspx.cs) -

在标记中 (.aspx) -

【讨论】:

  • 看起来不错,因为只有类名是服务器端属性。只需确保它在初始化时不为空
猜你喜欢
  • 2012-06-09
  • 2013-12-03
  • 1970-01-01
  • 2012-03-11
  • 2014-08-04
  • 1970-01-01
  • 1970-01-01
  • 2012-11-03
  • 1970-01-01
相关资源
最近更新 更多