Re: Cannot validate editor in GridView or DetailsView

  •  05-22-2008, 12:15 PM

    Re: Cannot validate editor in GridView or DetailsView

    Follow Up:
     
    Discovered that it wasn't the editor that was throwing the error but my placement of the RequiredFieldValidator. Should be inside the template rather that at the top of the page. The correct implementation is:

    <InsertItemTemplate>

    <CE:Editor ID="CeNewDescription" runat="server" Height="250" Width="100%" AutoConfigure="Minimal"

    BreakElement="P" Text="Enter Description">

    </CE:Editor>

    <asp:RequiredFieldValidator ID="rqv3" runat="server" ControlToValidate="CeNewDescription" ErrorMessage="You must enter a description." />

    </InsertItemTemplate>

     
    This resolves the error message issue but does not resolve the issue of the user being required to enter a value. In this particular case I have a message "Please overwrite this with a product description." If I simply delete the message and submit the form the RequiredFieldValidator doesn't fire and the form submits with a blank value. Does the editor write the opening and closing tags, e.g. <div></div>, even if nothing is entered in the box? Is there a way to set the editor so that it doesn't write the opening and closing tags (if that it what it's doing) so it doesn't trick the RequiredFieldValidator?
View Complete Thread