Saturday, July 16, 2011

Have you deleted your list edit or display webpart?

If you or anybody else intentionally or unintentionally deleted view or edit item webpart in editform.aspx or dispform.aspx page or if you one day come and see your list menu url for edit or view item redirect you to the home page instead of list forms pages, you can fix your page by:
1- open both editform.aspx and dispform.aspx in SharePoint Designer.
2- copy the webpart code from incorrupt page to corrapt one inside WebPartPages:ListFormWebPart tag.
3- if the corrupt page is editform.aspx change ControlMode from Display to Edit and FormType from 4 to 6 and if your corrupt page is dispform.aspx do it vice versa
4- Save your file and close the Designer

I highlighted those parts you need to change:
<WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate>
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{CF23ABCB-183A-4333-9E4F-898160A14A94}" >
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>پیشنهادات و انتقادات</Title>
  <FrameType>Default</FrameType>
  <Description />
  <IsIncluded>true</IsIncluded>
  <PartOrder>1</PartOrder>
  <FrameState>Normal</FrameState>
  <Height />
  <Width />
  <AllowRemove>true</AllowRemove>
  <AllowZoneChange>true</AllowZoneChange>
  <AllowMinimize>true</AllowMinimize>
  <AllowConnect>true</AllowConnect>
  <AllowEdit>true</AllowEdit>
  <AllowHide>true</AllowHide>
  <IsVisible>true</IsVisible>
  <DetailLink />
  <HelpLink />
  <HelpMode>Modeless</HelpMode>
  <Dir>Default</Dir>
  <PartImageSmall />
  <MissingAssembly>وارد کردن این جزء وب ممکن نیست.</MissingAssembly>
  <PartImageLarge />
  <IsIncludedFilter />
  <ExportControlledProperties>true</ExportControlledProperties>
  <ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
  <ID>g_cf23abcb_183a_4333_9e4f_898160a14a94</ID>
  <ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{437B63DD-D5CE-4C66-8931-21318AD31AF2}</ListName>
  <ListItemId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ListItemId>
 
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Display</ControlMode> 
 <TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">ListForm</TemplateName> 
 <FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">4</FormType> 
<ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">1048576</ViewFlag>
</WebPart>
</WebPartPages:ListFormWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>