0

私は次のエラーに直面しています:

Literal content ('</asp:RequiredFieldValidator>') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection' 

次のコード(customer.ascx内)の場合:

<div class="customerTableRow">
    <div class="customerTableLeftCol">
        <asp:Label ID="CustomerCountryLabel" runat="server" Text="Country:"></asp:Label>
    </div>
    <div class="customerTableRightCol">
        <asp:DropDownList ID="CustomerCountryDropDownList" runat="server">
            <asp:RequiredFieldValidator ID="CustomerCountryRequiredFieldValidator" ControlToValidate="CustomerCountryDropDownList" runat="server" ErrorMessage="RequiredFieldValidator">
            </asp:RequiredFieldValidator>
        </asp:DropDownList>
    </div>
</div>

私は何かが足りないのですか?

4

1 に答える 1

1

RequiredFieldValidatorをDropDownListから移動します

<div class="customerTableRow">
    <div class="customerTableLeftCol">
        <asp:Label ID="CustomerCountryLabel" runat="server" Text="Country:"></asp:Label>
    </div>
    <div class="customerTableRightCol">
        <asp:DropDownList ID="CustomerCountryDropDownList" runat="server">
        </asp:DropDownList>


            <asp:RequiredFieldValidator ID="CustomerCountryRequiredFieldValidator" ControlToValidate="CustomerCountryDropDownList" runat="server" ErrorMessage="RequiredFieldValidator">
            </asp:RequiredFieldValidator>
    </div>
</div>
于 2012-12-31T04:14:22.183 に答える