Ajax手风琴窗格中的必填字段验证器不起作用 [英] Required Field Validator in Ajax Accordion Pane is not working

查看:55
本文介绍了Ajax手风琴窗格中的必填字段验证器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用Ajax Accordion面板。我们从数据集动态绑定ajax手风琴。所以我们不确定要绑定多少窗格。



现在我们在每个手风琴窗格中添加了几个文本框和1个按钮,这是mandotory所以我们使用了必需的字段验证器。 br />


问题是当我在第一个窗格中的第一个窗格文本框中单击按钮显示它是必需的这很好,但即使我在第一个窗格中键入文本框。我无法在显示必须的剩余窗格中保存文本框。请指导我。



We using Ajax Accordion pane. We dynamically binding ajax accordion from data set. So we not sure how much pane wil be bind.

Now we added few textbox and 1 button in each accordion pane which is mandotory so we used required field validator.

The problem is when i click buton in first pane textbox in first pane showing "It is required" which is fine but even if i typed textbox in first pane. I am not able to save since textbox in remaining pane showing "It is required". Please guide me.

<cc1:Accordion ID="accRcvDetails" runat="server" SelectedIndex="-1" ContentCssClass="accordion-content" RequireOpenedPane="false" HeaderCssClass="accordion-header"

                                     HeaderSelectedCssClass="accordionSelected" OnItemCommand="accRcvDetails_ItemCommand" OnItemDataBound="accRcvDetails_ItemDataBound">

                                     <HeaderTemplate>
     </HeaderTemplate>
                                     <ContentTemplate>
    <td class="searchlabel">
                                                         <asp:Label ID="lblNotes" runat="server" Text="Notes:"></asp:Label>
                                                     </td>
                                                     <td class="searchtext" colspan="3">
                                                         <asp:TextBox runat="server" ID="txtNotes" Width="100%" TextMode="MultiLine" Height="35px" />
                                                         <asp:RequiredFieldValidator ControlToValidate="txtNotes" Text="Note Field is Required" runat="server" />
                                                     </td>
                                                     <td>
     <td style="text-align: right" colspan="8">
                                                         <asp:Button ID="btnSave" CssClass="searchbutton Accbtnsave" runat="server" CommandName="Save" Text="Save" />
                                                     </td>
 </ContentTemplate>


                                 </cc1:Accordion>

推荐答案

您需要为不同的窗格生成不同的ValidationGroup。您可以在OnItemDatabound中以编程方式执行此操作。还要确保同一窗格的保存按钮与RequiredFieldValidator具有相同的ValidationGroup。



如果您需要进一步的帮助,请回复在这里!
You need to generate different "ValidationGroup" for different pane. You may do that programatically in "OnItemDatabound". Also make sure that the "Save" button of the same pane has the same "ValidationGroup" as the "RequiredFieldValidator".

In case you need further help, please reply here !


这篇关于Ajax手风琴窗格中的必填字段验证器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆