Creating Custom List Forms for Creating, Editing, or Displaying a List Item
-
06-12-2019 - |
문제
I'm following this article (as well as different MSDN pages) and trying to add some custom template forms to my content type.
I think I'm doing all by the book, but for some reason wont deploy my version of the content type.
Instead of my XmlDocument
I get the default one which is:
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
The Display
, Edit
and New
entries are not my own. ListForm
is the default.
My .ascx
just contains some div with text in it. Just a test. It's in the right place in the CONTROLTEMPLATES folder.
What am I missing? How can I deploy with my custom templates?
해결책
That happened with me whenever there is an issue with your templates. I forgot what was my exact reason but there has to be some issue with your templates.
Also, in order to override the templates, I realized, there is an Inherits attribute set to 'TRUE' in your definition for content type. Set that to 'FALSE' and it will pick your custom templates.
다른 팁
I think that you use incorrect rendering template ID. You should specify this id in your template. look at the excample:
<SharePoint:RenderingTemplate ID="CustomContentTypeCreateForm" runat="server">
Then you should use this id in your schema.
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<New>CustomContentTypeCreateForm</New>
</FormTemplates>
In you case, I think, SharePoint looks for ListForm id and takes default template instead of your template.