下拉列表的RequiredFieldValidator不适用于验证组

时间:2015-03-25 06:01:36

标签: asp.net

我在tabpanel中有两个下拉列表。

出于某种原因,我的第一个下拉列表需要字段验证器不起作用,并且在验证摘要中不显示错误消息。我检查了初始值2,3次...而0是正确的值。如果我将索引零设置为初始值为0,它只是将数据发布到服务器。

然而,我的第二个下拉验证器正在运行。 两者都在按钮上获得了相同的验证组。

<div class="Form_Input_Bigbg" id="divManagerRating" runat="server">
    <div class="Form_Label_Editor">
        <asp:Label ID="lblM`enter code here`anagerComment" runat="server"></asp:Label>
        <%--Manager Comment--%>
    </div>
    <div style="clear: both"></div>
    <div id="rating8" runat="server">
        <div class="Form_Input_Big">
            <asp:DropDownList ID="ddlManagerRating" Width="200px" runat="server" CssClass="Form_InputField">
            </asp:DropDownList>
        </div>
        <div class="error_Text_alert">
            <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" ControlToValidate="ddlManagerRating"
                ErrorMessage="Rating for Manager Comment required." Text="*" ForeColor="Red"
                InitialValue="0" ValidationGroup="PublishMid"></asp:RequiredFieldValidator>
        </div>
    </div>
</div>

<div class="Form_Input_Bigbg" id="divMidRecommendedRating" runat="server">
    <div class="Form_Label_Editor">
        <asp:Label ID="lblMidYearPerformanceRatingAndExplanation" runat="server"></asp:Label>
        <%--Mid year performance rating & explanation--%>
    </div>
    <div style="clear: both"></div>
    <div id="divMidYearPerformanceRatingAndExplanationRating" runat="server">
        <div class="Form_Input_Big">
            <asp:DropDownList ID="drpMidRecommendedRating" Width="200px" runat="server" CssClass="Form_InputField">
            </asp:DropDownList>
        </div>
        <div class="error_Text_alert">
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="drpMidRecommendedRating"
                ErrorMessage="Rating for Mid year performance rating & explanation required."
                Text="*" ForeColor="Red" InitialValue="0" ValidationGroup="PublishMid"></asp:RequiredFieldValidator>
        </div>
    </div>
</div>

<div id="divBtnPublish" runat="server">
     <asp:Button ID="btnFinish" runat="server" CssClass="BtnRegular_Container"
         Text="Publish" OnClick="btnFinish_Click"
         OnClientClick="SetCheck()" ValidationGroup="PublishMid" />
</div>

0 个答案:

没有答案