0

I think my subject line pretty much asks the question. I have a control inside a nested repeater that I need to validate.

Here's a quick 'n dirty as to how it looks (note: attributes/lines left out for brevity):

<asp:Repeater ID="outsideRepeater">
    <ItemTemplate>
        <asp:Repeater ID="middleRepeater">
            <ItemTemplate>
                <asp:Repeater ID="insideRepeater">
                    <ItemTemplate>
                        <asp:TextBox ID="someDate" CausesValidation="true" />
                    </ItemTemplate>
                </asp:Repeater>
            </ItemTemplate>
        </asp:Repeater>
    </ItemTemplate>
</asp:Repeater>

<asp:RegularExpressionValidator ID="valSomeDate" ControlToValidate="someDate">
</asp:RegularExpressionValidator>

The number of times that "someDate" can repeat is irrevelant; the point is that "someDate" can repeat.

When I run this, I get:

Unable to find control id 'someDate' referenced by the 'ControlToValidate' property of 'valSomeDate'.

How do I get around this?

Thanks!

Ray K.
  • 2,431
  • 3
  • 25
  • 39
  • 1
    Repeater assumes that you will have more than one control, how do you plan to use single validator for all of them? If required, you can place validator inside item template, this will work – Uriil May 05 '14 at 14:40
  • This is true. I know that when the page is rendered, the ID is "reassigned" (in a matter of speaking) so that each control is considered unique. I was wondering if there was a way to adapt the ControlToValidate property in a way to work for all controls. – Ray K. May 05 '14 at 15:19
  • Also, this isn't working quite the way I want. In my scenario, the form is within a wrapper that contains code to pop-up validation messages, and I want to include my form with that. I'm working on trying to tweak this to work that way as we speak. – Ray K. May 05 '14 at 15:22

0 Answers0