Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

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

1 solution

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 !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900