简体   繁体   English

自定义SharePoint 2010表单

[英]Custom SharePoint 2010 forms

Am I required to use InfoPath to create custom forms for SharePoint 2010, or can I create them using Visual Studio? 我是否需要使用InfoPath为SharePoint 2010创建自定义表单,还是可以使用Visual Studio创建它们? For example, when a Task is being edited, I want to be able to either edit the form, or create one from scratch. 例如,在编辑任务时,我希望能够编辑表单或从头开始创建一个。

Many thanks. 非常感谢。

InfoPath or SharePoint Designer are the main tools to use when building custom content to run in SharePoint. InfoPath或SharePoint Designer是构建自定义内容以在SharePoint中运行时要使用的主要工具。

Hard to say which route is best for you without knowing the spec of the forms but I'd recommend you have a play with each. 在不了解表格规格的情况下很难说出哪种路线最适合您,但我建议您一起玩。 The Designer route can be more powerful if you're happy diving in to the rather messy markup that SharePoint spews out. 如果您希望深入了解SharePoint产生的混乱标记,则Designer路线可能会更强大。

If you want to edit the form that is displayed when a task is added / edited, you should go for SharePoint designer instead of InfoPath and apply the required customizations to the relevant associated page of the targeted list (eg : newform.aspx) by playing with a dataform web part. 如果要编辑添加/编辑任务时显示的表单,则应使用SharePoint Designer而不是InfoPath,并通过播放将所需的自定义应用到目标列表的相关关联页面(例如:newform.aspx)。与数据表单Web部件。

Otherwise, you can create a user control and wrap it in a webpart to manage the task creation / edition the way you want. 否则,您可以创建用户控件并将其包装在Web部件中,以按所需方式管理任务的创建/编辑。 You can then place that webpart at the most relevant location(s). 然后,您可以将该Webpart放置在最相关的位置。 You can then make the "storage" list hidden so people will not fall back on the default form templates to add / edit items (unless they figure out the url, but you can remove all permissions and run with elevation if it's an issue). 然后,您可以隐藏“存储”列表,这样人们就不会再依赖默认的表单模板来添加/编辑项目了(除非他们弄清楚了url,但是如果有问题,您可以删除所有权限并以高程运行)。

You can create your own form for a custom list definition. 您可以为自定义列表定义创建自己的表单。 Inside your list you have a file schema.xml . 在列表中,您有一个文件schema.xml In the end you will find sth like this: 最后,您会发现……

<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>

Then create files with those names inside list definition, make adjustments in SharePointProjectItem.spdata file (it's hidden) and there you have it. 然后使用列表定义内的这些名称创建文件,在SharePointProjectItem.spdata文件(已隐藏)中进行调整,然后就可以使用了。

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

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