I am trying to use some custom list form templates (only for Display Forms), using the technique described in this MSDN article.

My basic technique is as follows:

  • Create a blank .aspx page (no code-behind)
  • Copy the page directives from \15\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.aspx
  • Copy the template I want to customize from DefaultTemplates.aspx
  • Add my customizations, and rename the id of the template to my custom name
  • Reference my custom template name in the Template attribute of the Display Form form element in my list definition Schema.xml, like:

<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" Template="MyCustomForm" WebPartZoneID="Main" />

  • Deploy my list definition and deploy my custom form template .aspx file to the root of the CONTROLTEMPLATES directory.

This works as expected if I copy and try to use a custom ListForm template for a regular list.

However, it seems that Document Libraries don't use the ListForm template, they use the DocumentLibraryForm template, which in turn references the DocumentLibraryFormCore template.

I tried using the above technique to create a custom DocumentLibraryForm, and kept the reference to the default DocumentLibraryFormCore template, as all of my customization could be contained in the outer template. However, SharePoint never seems to load my custom template. I have double, triple, quadruple checked that there is not a typo between the id that I am setting in the template file and what I reference in the Template element in my list definition Schema.xml.

I have even tried cutomizing both the DocumentLibraryForm and the DocumentLibraryFormCore templates, and referencing my custom Core form from my custom DocumentLibraryForm, and still nothing.

I have also searched for "DocumentLibraryForm" within the DefaultTemplates.aspx file to see if there is another template that calls the DocumentLibraryForm template, and is really the "outer" template I should be customizing, but there is none.

Why is SharePoint ignoring my custom form template?

Is there another template in a different file that I need to be overriding/customizing?

1 Answer 1


Ok, figured it out.

The issue was that for the custom list where I used a custom ListForm successfully, I was using a simple custom content type and in my content type definition had Inherits="FALSE", which caused the content type to defer to the form template specified in the list schema.

In the document library, I was using a custom content type that inherited from Document, and had Inherits="TRUE" in the definition, because Document is not the simplest content type and I didn't feel like re-constructing the whole thing just to add one custom column.

However, that meant that even if I specified my own XmlDocuments section in the content type definition to specify a custom form template, that would ultimately be ignored and replaced with the default document form templates, because Inherits="TRUE" causes that behavior. So my content type would end up with an XmlDocuments section calling for the default DocumentLibraryForm template for all forms, which would be used preferentially over the form template specified in the list schema.

So the answer was to add a feature receiver to go in and programmatically change the SPContentType.DisplayForTemplateName property of my custom document content type to be my custom display template name, after the content type had been deployed to the site and had already been given the default form templates.

Your Answer

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

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