tags:

views:

31

answers:

1

I have a user control (form) inside a user control (grid) with a Validator in the form. A snippet from the code is below

<asp:tablerow>
    <asp:tablecell HorizontalAlign="center" columnspan="2" >
        <asp:ValidationSummary runat="server" id="ValidationSummary1" />
    </asp:tablecell>
</asp:tablerow>
<asp:tablerow>
    <asp:tablecell HorizontalAlign="left" style="padding-left:250px;" >
        <asp:label ID="Label1" runat="server" Text="Foo:" AssociatedControlId="txtFoo" />
    </asp:tablecell>
    <asp:tablecell HorizontalAlign="left" style="padding-right:200px;" >
        <asp:textbox runat="server" id="txtFoo" Text="" />
        &nbsp
        <asp:RequiredFieldValidator 
                            ID="RequiredFieldValidator1" 
                            runat="server" 
                            ErrorMessage="Foo is a Required Field" 
                            Text="*" 
                            ControlToValidate="txtFoo" />
    </asp:tablecell>
</asp:tablerow>

This code is identical to code in another user control where the parent is not a user control and that page works fine, but on this page the Validator doesn't fire and the Foo_ItemCommand method fires instead. I tried searching Google and StackOverFlow but haven't been able to find anything that helps.

Thanks for any assistance you might have.
Dan

A: 

try to use ValidationGroup for validation controls and submit control.

DEVMBM