Validator keeps panel from hiding.

Dear Experts,
I have a complex form that needs different portions to be visible or hidden at different times as the user chooses. One of the panels has a text field with a RequiredFieldValidator. Without the RequiredFieldValidator the hide button works fine with the validator the panel won't hide because the validator is looking for input. I need to hide the panel even if the student ID text box is empty. How would I set the properties to allow this function? Below is the code.

HTML:
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td style="font-family: Arial, Helvetica, sans-serif" class="auto-style24">Add Student to Class</td>
                <td><asp:Button ID="btnAddStudentToClassDisplay" runat="server" Text="Display" OnClick="btnAddStudentToClassDisplay_Click" /></td>
                <td><asp:Button ID="btnAddStudentToClassHide" runat="server" Text="Hide" OnClick="btnAddStudentToClassHide_Click" /></td>
            </tr>

        </table>
    </div>
    <div>
        <asp:Panel ID="pnlAddStudentToClass" runat="server" Visible="false" Font-Bold="True">

        <asp:TextBox ID="txtStudentId" runat="server" Width="73px" ValidationGroup="AddStudent" BackColor="Yellow" BorderColor="Black" BorderStyle="Groove" BorderWidth="2px" ForeColor="Black" ></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="btnLookUpId" runat="server" Text="Look Up"/>
        <asp:RequiredFieldValidator ID="rfvStudentIdLookup" runat="server" ErrorMessage="Enter Student ID" SetFocusOnError="True" ControlToValidate="txtStudentId" Display="Static" Font-Names="Arial" ToolTip="Enter Student ID"></asp:RequiredFieldValidator>

        </asp:Panel>
    </div>
    </form>
</body>

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _icss_TestPages_HidePanelWithValidator : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAddStudentToClassDisplay_Click(object sender, EventArgs e)
    {
        pnlAddStudentToClass.Visible = true;
    }
    protected void btnAddStudentToClassHide_Click(object sender, EventArgs e)
    {
        pnlAddStudentToClass.Visible = false;
    }
}

Thank you.
bobbellowsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dejaanbuCommented:
try setting  the   ValidationGroup="AddStudent" for the Button and the RequiredFieldValidator too

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobbellowsAuthor Commented:
Thanks,
I missed that.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.