【问题标题】:How to use css in asp.net for web server control?如何在 asp.net 中使用 css 进行 Web 服务器控制?
【发布时间】:2012-11-24 20:43:10
【问题描述】:

在 asp.net 中使用 Web 服务器控件,但在 Visual Studio 中,为什么下面的代码没有出现样式属性

  <asp:Label ID = "UserLabel" runat = "server" CssClass = "LabelClass" AssociatedControlID = "UsernameTextBox" >Username</asp:Label>

通过智能感知它应该是正确的,但样式属性根本没有出现。 我正在使用 Visual Studio 2010,使用 C# 的 asp.net

【问题讨论】:

  • 渲染的 HTML 是什么?你对应的样式表是什么?
  • 我正在使用 Visual Studio 2010,使用 c# 的 asp.net
  • 我不会在属性之间使用空格。可能是语法问题。
  • 通过智能感知样式属性应该来吧?

标签: asp.net css visual-studio-2010


【解决方案1】:

使用 asp 服务器控件时,Style 属性永远不会显示在智能感知上。输入Style="后,智能感知将显示属性

服务器控件继承 System.Web.UI.Control,它没有 style 作为属性。

但是,它将被呈现为 HTML。

【讨论】:

    猜你喜欢
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    • 2012-10-13
    • 2016-11-19
    • 2014-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多