【问题标题】:Element 'Listitem' is not a known element元素“Listitem”不是已知元素
【发布时间】:2017-07-27 14:42:00
【问题描述】:

我有一个下拉字段,但列表项似乎被忽略了。这是我在 Visual Studio 中工作的一个 aspx 项目。我错过了什么吗?我的代码:

<form runat="server">
  <asp:TextBox CssClass="form-control" ID ="dateField" runat="server" placeholder="Date (DD/MM/YYYY)"></asp:TextBox><br/>
   <asp:DropDownList CssClass="form-control" runat="server" placeholder="">   </asp:DropDownList>
    <asp:ListItem Text="General Waste" Value="General Waste"></asp:ListItem>
</form>

【问题讨论】:

    标签: html asp.net visual-studio


    【解决方案1】:

    您在ListItem 之前关闭了DropDownList 标记。 ListItem 应该在 DropDownList 中。

    <form runat="server">
        <asp:TextBox CssClass="form-control" ID ="dateField" runat="server" placeholder="Date (DD/MM/YYYY)"></asp:TextBox><br/>
        <asp:DropDownList CssClass="form-control" runat="server" placeholder="">   
            <asp:ListItem Text="General Waste" Value="General Waste"></asp:ListItem>
        </asp:DropDownList>
    </form>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 2011-08-16
      • 2014-05-13
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      相关资源
      最近更新 更多