【问题标题】:How do you create a new form for a custom Content Type如何为自定义内容类型创建新表单
【发布时间】:2012-06-07 17:26:22
【问题描述】:

我正在通过 Visual Studio 中的 Elements.xml 文件创建新的内容类型。我在 XmlDocment 节点中引用了一个自定义的新表单文档

  <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>MyNewList</New>
    </FormTemplates>
  </XmlDocument>

现在,当我创建内容类型的新实例时,我得到一个空白。我已经读到这个新节点应该引用一个 ASCX 控件。但是我还没有找到任何好的例子来引导我完成这个过程。

【问题讨论】:

    标签: sharepoint sharepoint-2010 content-type sharepoint-api


    【解决方案1】:

    您在&lt;New&gt;&lt;/New&gt; 元素中指定的值是_controltemplates 目录中RenderingTemplate 控件的ID。如果你打开

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx
    

    您将看到 SharePoint 使用的呈现模板,包括 ListForm。您可以通过在同一目录中创建新的 ASCX 文件来创建自己的渲染模板。 This is an article 将引导您完成此操作。

    【讨论】:

      【解决方案2】:

      谢谢亚历克斯...为您解答。

      我了解了使用 FormTemplates 与 FormUrls 元素之间的区别。 FormsTemplate 用于引用自定义用户控件,使用现有的 aspx 页面。这由提供的链接 Alex 描述。一个同事指出了使用 FormUrls 的方向。 FormUrls 用于引用一个全新的 aspx 页面。

        <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <FormUrls xmlns:dd= "http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
            <New>_layouts/TMF/NewJobCard.aspx</New>
          </FormUrls>
        </XmlDocument>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-02-26
        • 1970-01-01
        • 2015-12-11
        • 1970-01-01
        • 1970-01-01
        • 2014-03-07
        • 1970-01-01
        相关资源
        最近更新 更多