繁体   English   中英

如何在Sharepoint2010(C#)中创建带有代码隐藏列表的自定义窗体

[英]How to create a custom form with codebehind to List in Sharepoint2010 (C#)

我在Visual Studio(C#)中为Sharepoint2010创建了列表定义和列表实例。 还创建了“应用程序”页面,默认情况下存储在布局文件夹中。 我的目标是使该页面成为列表的新形式。 据我了解,应该在列表架构的这一部分中完成:

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>

我尝试过:

1)在<forms>标记中添加<New>_layouts/PIUVS/ProjectsNew.aspx</New> =>然后什么也没发生

2)部署时将SetupPath更改为“ _layouts / PIUVS / ProjectsNew.aspx” =>出现错误: 错误:

PS我不使用SP Designer或类似的程序。

找到了解决方案。

这不应该完全在模式文件中完成。

要将自定义表单添加到Sharepoint2010中的列表中,应修改内容类型。 <ContentType>标记中添加以下内容:

<XmlDocuments>
  <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
    <FormsUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
      <New>_layouts/PIUVS/ProjectsNew.aspx</New>
    </FormsUrls>
  </XmlDocument>
</XmlDocuments>

还要将此内容复制到列表模式的ContentType引用中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM