'Required field validator is not working in update panel

I have a textbox and a button control in a panel which is in update panel. I want to validate textbox if it is empty on button click. Actually this panel is using for Modal Popup Extender functionality. For pop up I am using AJAX modal popup extender control.

I am using Requiredfieldvalidator control to validate textbox but it is not firing on button click.

Code:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none">
                <asp:TextBox ID="TextBox1" runat="server" Visible="false" CausesValidation="true"></asp:TextBox>

                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="TextBox1"
                                                                    ErrorMessage="Data is Required">
                    </asp:RequiredFieldValidator>
                <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="btnSubmit_Click" CausesValidation="true" />
             </asp:Panel>
     </ContentTemplate>
    <Triggers>

       <asp:AsyncPostBackTrigger ControlID="Button1" />
    </Triggers>
</asp:UpdatePanel>

Any solution?

Edit

<cc1:ModalPopupExtender ID="mpePopUp" runat="server" DropShadow="false" PopupControlID="Panel1"
                                        TargetControlID="lnkFake" BackgroundCssClass="modalBackground">
                                    </cc1:ModalPopupExtender>

Code behind: I have link button in gridview.. clicking on that link the popup should be dislpayed. In gridview row command event I am using popup show method

mpePopUp.show();



Solution 1:[1]

add validation group and remove cause validation from text box try it

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none">
                <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>

                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="TextBox1" validationgroup="Group1" ErrorMessage="Data is Required">
                    </asp:RequiredFieldValidator>
                <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="btnSubmit_Click" validationgroup="UserInfoGroup"  CausesValidation="true" />
             </asp:Panel>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 COLD TOLD