I have an ascx control that inherits from ValidatableUserControl.

I have several requiredfieldvalidators on the page, and all of them are getting fired except the one inside an asp:panel

This code is inside a <table>

<asp:Panel runat = "server" ID = "PurchaseOrderPanel">
                <tr>
                  <td><div  class="txtClass">
                  <span class="required">*</span>
                  Number:
                  </div>
                  </td>
                  <td>
                  <asp:textbox  CssClass = "txtClass" size="47" runat="server" id="Number" ></asp:textbox>
                   <asp:requiredfieldvalidator id="NumberRequired" runat="server" controltovalidate="Number" errormessage="Number is a required field" >*</asp:requiredfieldvalidator>
                  </td>
                 </tr>
              </asp:Panel>

If I move the requiredfieldvalidator outside of the asp:panel, it would work, but that breaks the formatting.

The codebehind also uses

public override string ValidationGroup {
set {
base.ValidationGroup = value;
FirstNameRequired.ValidationGroup = LastNameRequired.ValidationGroup
= telPhone.ValidationGroup = value;
}
}

However, the controls other than firstname, lastname and telphone are properly being fired too, and none of those have any validation group attached to them.

(Note: the code is not entirely written by me, I am just trying to add the asp:panel control to someone else's code)

I just made it work by adding NumberRequired.ValidationGroup in that snippet from codebehind that I posted but I am still confused why I had to add that while other controls were working just fine... hmm!

brother mark the thread as resolved if your problem is solved...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.