Provisioning webparts into SharePoint List Item Forms using schema
In my last couple of posts I described how you can create a custom list item form and have it call your own masterpage and have various other placeholders to contain your content.However, you wouldn’t be able to replace existingListFormWebPart with your own functionality.
The approach described below will not only allow you to replace a defaultListFormWebPart but also let you easily add addinional webparts just as you would define them when provioning a page using a feature.
Here is what we`ll add at the very bottom of our schema file where all of the display/edit/new forms are defined:
<ContentTypes>…</ContentTypes>
<Forms>
<Form Type=”NewForm” Url=”NewForm.aspx” WebPartZoneID=”Main” />
<Form Type=”DisplayForm” Url=”DispForm.aspx” WebPartZoneID=”Main” />
<Form Type=”EditForm” Url=”EditForm.aspx” WebPartZoneID=”Main” /><Form Type=”0″ Url=”MyCustomForm.aspx” WebPartZoneID=”Main”>
<WebParts>
<AllUsersWebPart WebPartZoneID=”Main” WebPartOrder=”0″><![CDATA[<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">
...</WebPart>]]>
</AllUsersWebPart>
</WebParts>
</Form>
</Forms>
Pretty clean and quick, here is more on the topic
