0

I have a custom edit form - a ".aspx" page - which I want to make changes to. Since the existing one is being used, we make a copy of that one and edit it off to the side, until it has been verified.

MyPage.aspx > copy to MyPageA.aspx

Once I make the copy, I can go to MyPageA.aspx without a problem. But if I simply edit in advanced mode, do NOTHING, save and check in, now I get the following error:

Only Content controls are allowed directly in a content page that contains Content controls.

headers include reference to the master page file

<%@ Page Language="C#" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" masterpagefile="~masterurl/default.master" title="|" meta:progid="SharePoint.WebPartPage.Document" %>

and the content sections something like this:

<asp:Content id="Content1" runat="Server" contentplaceholderid="PlaceHolderMain">
...
</asp:Content>
<asp:Content id="Content2" runat="server" contentplaceholderid="PlaceHolderAdditionalPageHead">
...
</asp:Content>

<WebPartPages:WebPartZone runat="server" ID="__WebPartPageLibraryZone__"><ZoneTemplate>

    ...
    </WebPartPage:WebPartZone>

So right away, that error suggests not to leave stuff outside the asp:Content tags. Ok. I notice the "webpartzone" stuff is outside the asp:Content tags at the end of the page. But then again, it works on the original just fine, and still works with a copy. Its only once "Edit in Advanced Mode" opens and saves it that stuff is screwed up.

My question - does Sharepoint somehow change the type of page it sees once I edit/save in advanced mode, even if I don't do any changes? It's as if the type of page changes.

I found I can open in Notepad and sometimes do some edits, but that seems to have other unintended changes.

Thanks in advance for your feedback.

1
  • Follow up on this...I found a way to make it work, though my question still stands above. Here's how I had to do it: 1) In SharePoint designer, copy the original aspx page and rename the copy 2) Check Out 3) Open with Notepad 4) Make changes 5) Find the ending "asp:Content" tag, and move it to the very end of the page (repeat this for every change we make because it will move it every time) 6) Save/Close 7) Check In 8) View Page I found that each time I go to edit the page in Notepad, it will move the </asp:Content> tag ahead of a bunch of "WebPartPages:WebPartZone tags...EVERY TIME!
    – Chad
    Jan 25, 2013 at 20:38

1 Answer 1

1

It is not unheard of that SharePoint Designer throws in some HTML or the opposite, deletes some, when saving. Look for unclosed control tags when you open the page in SharePoint Designer

2
  • Thanks @Dandroid. I've certainly been seeing that. You'll see in my comment above that SP Designer keeps moving my ending asp:Content tag up for some reason. Also, if I edit in advanced mode, it will put a <head></head> tag up top, which also causes this error. I just wonder what designer thinks to make it try these adjustments.
    – Chad
    Jan 25, 2013 at 20:41
  • 1
    @Chad SPD tries to fix the missing parts in pages opened in edit mode. Your best shot is to modify you aspx page in Visual Studio or Notepad(++) to avoid these "fixes"
    – user2536
    Jan 25, 2013 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.