解决方法:http://kitmenke.com/blog/2010/12/11/customizing-editform-aspx-in-a-publishing-site/
SPD打开该List
在EditForm.aspx上右键,点击“根据现有网页创建”
新网页中 添加黄色部分
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"/><asp:Content ContentPlaceHolderId="SPNavigation" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
保存页面至当前位置
在SPD中List上右键属性,“支持文件”中,将Folder,Item的Edit都修改为新的aspx
After recently doing a lot of work heavily customizing NewForm.aspx and EditForm.aspx for a SharePoint list, I ran into a major issue after I moved my list into a publishing site. The issue appeared when I added a webpart onto my EditForm.
As soon as another webpart was added, the entire page switched into some sort of weird publishing mode.
This new mode has a couple of changes to the form:
- A publishing toolbar now appears at the top
- Every field in the List View Web Part has an additional “form” label
- Additional JavaScript is added to the page that prompts the user to save whenever an attempts to navigate somewhere differently: To save your changes before continuing, click “OK”. To continue without saving changes, click “Cancel”.
In my case, this new mode definitely would not work for what I was trying to do. The labels increase the size of the form dramatically, the publishing toolbar makes it seem as if you are editing the page rather than a list item, and this new mode does NOT appear on NewForm.aspx which means the forms are dramatically inconsistent.
After googling, I found a couple of people who have had similar issues. The root cause seems to be the Office SharePoint Server Publishing site feature. Since disabling the feature on the site was not an option, I had to find another way. JavaScript and CSS was a viable option (since I’m customizing the form using these anyway) but I felt like I needed a more bullet proof method.
My method involves using SharePoint Designer to customize EditForm.aspx. (Updated January 13th, 2011 after ADE’s comment below. Thanks a lot!)
Step 1: Create a new custom EditForm.aspx by right clicking on EditForm.aspx, click “New From Existing Page”
Step 2: Add the SPNavigation line in right before PlaceHolder Main:
<asp:Content ContentPlaceHolderId="SPNavigation" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
Step 3: Save your new CustomEdit.aspx into the same directory as EditForm.aspx
Step 4: Verify your list now is associated with your new CustomEdit.aspx by right clicking on the list in SharePoint Designer and clicking “Properties”.
Your new edit form should be listed under the Supporting Files tab for Edit item form: