如何在sharepoint列表视图中使用自定义dispForm?

时间:2015-08-06 10:53:42

标签: sharepoint

我正在使用列表视图来显示共享点2013中的列表项。当用户单击标题时,应显示自定义页面,而不是共享点的默认显示页面(dispForm.aspx)。

1 个答案:

答案 0 :(得分:1)

在contentType中定义XmlDocuments:
https://msdn.microsoft.com/en-us/library/office/aa543825.aspx

示例:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Workflow Task (0x010801) -->
  <ContentType ID="0x010100AF4E4BE6CF8048959C4172F4298CE42A"
               Name="MyName"
               Group="MyGroup"
               Description="MyDescription"
               Version="0">
    <FieldRefs>
    </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI ="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <New>_layouts/MyFolder/New.aspx</New>
          <Display>_layouts/MyFolder/New.aspx</Display>
          <Edit>_layouts/MyFolder/Edit.aspx</Edit>
        </FormUrls>
      </XmlDocument>
    </XmlDocuments>
  </ContentType>
</Elements>

在后面的代码中,您获得当前项目

SPListItem item = SPContext.Current.ListItem;