R – SharePoint custom controltemplate not being applied

controltemplatesharepointsharepoint-2007

I'm having trouble with a custom control template.

My intention is to use a custom control template on a NewForm.aspx for a list.

  1. I have created a CustomTemplate.ascx file and this is deployed to 12/Template/CONTROLTEMPLATES

    <SharePoint:RenderingTemplate ID="CustomListForm" runat="server" >...

  2. I have modified the schema.xml file for the list to use my custom template:

    <Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main" Template="CustomListForm" />

My NewForm.aspx page still shows the default view however. This is for both new and existing lists based on my list template. I have tried restarting IIS around deployment but this doesn't help.

If I change the name of my template to "ListForm", this successfully overwrites the default template as expected, and I can see the change in existing and new lists.

I've looked for help on this site and Google, but can't find anything. Has anyone come across this before?

Best Answer

Make sure the TemplateName in your content type is null or empty string. TemplateName defined in ContentType will override any TemplateName defined in the list schema.

FYI, the out of the box content type 'Item' have NewFormTemplateName set to 'ListForm', this will override any custom template name defined in your list schema.

Related Topic