Cannot validate editor in GridView or DetailsView

  •  05-22-2008, 10:16 AM

    Cannot validate editor in GridView or DetailsView

    I have no problem validating the editor when I incorporate it in a Table control but I can't make it work in a GridView. The result is the error: "Unable to find control id 'CeName' referenced by the 'ControlToValidate' property of 'RequiredFieldValidator1'." I'm guessing I will have to do this with code behind.
     
    Here's the relevant ASPX markup:
     
    Outside GridView and DetailsView:

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="You must enter a name." ControlToValidate="CeName"></asp:RequiredFieldValidator>

    Inside GridView:

    <EditItemTemplate>

    <CE:Editor ID="CeName" runat="server" Height="250" Width="100%" AutoConfigure="None"

    BreakElement="Br" Text='<%# Eval("Name") %>'>

    </CE:Editor>

    </EditItemTemplate>

View Complete Thread