SharePoint Config

Ari Bakker's thoughts on customising and configuring SharePoint

ASP.NET validation controls prevent publishing pages from saving

with 6 comments

The situation

You have an ASP.NET control that contains validation controls in the masterpage or page layout for a publishing site (an ASP.NET login control for example). When you try to edit and check in a publishing page you receive the following error.

This page contains content or formatting that is not valid. You can find more information in the affected sections.

The problem

Even if you fill in all the required fields on the publishing page, the validation controls on the other ASP.NET controls prevent the page from saving.

The solution

One quick way of rectifying this problem is to place an EditModePanel with PageDisplayMode=”Display” around the controls to prevent them from displaying when the page is in edit mode. For example:

<PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Display">
<asp:Login runat="server" id="Login1"></asp:Login>
</PublishingWebControls:EditModePanel>

This will only render the control when the page is in ‘Display’ mode so validation will not occur when users are editing the publishing page.

Post to Twitter Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Written by Ari Bakker

September 23rd, 2007 at 1:29 am

6 Responses to 'ASP.NET validation controls prevent publishing pages from saving'

Subscribe to comments with RSS or TrackBack to 'ASP.NET validation controls prevent publishing pages from saving'.

  1. This post came in very helpful to me today. Thanks, Ari!

    Tom Resing

    1 Oct 09 at 4:13 pm

  2. Thanks alot .. 🙂

    Prince K

    1 Apr 09 at 11:11 am

  3. Thanks!!! Very good and helpful post!

    Vinícius

    27 Aug 10 at 9:13 pm

  4. Excellent tip !!! Last 2 days I was struggling to provide the solution for this issue. It really helped me a lot.. Thanks for posting it….

    KK

    11 Feb 11 at 12:18 pm

  5. Thank you for the tip…I tried for 6 hours to figure out this via code…this works like a charm..

    Nalini

    22 Aug 11 at 8:00 pm

  6. THX a lot for the tip !
    This issue drives me crazy :p

    lexxus93600

    8 Sep 14 at 4:04 pm

Leave a Reply

*