2017-03-07 155 views
0

我有一個下拉字段,但是List Items似乎被忽略。這是我在Visual Studio中開發的一個aspx項目。我錯過了什麼嗎?我的代碼:元素'Listitem'不是已知元素

<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> 

回答

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> 
+1

謝謝!這是一個簡單的一個-_- – Richard1996

相關問題