简体   繁体   English

如何用SP2007以编程方式自定义editform.aspx / newform.aspx?

[英]How to programmatically customize editform.aspx/newform.aspx with SP2007?

I have been looking for a solution for hours but I can't manage to customize my list forms. 我一直在寻找解决方案达数小时之久,但无法自定义列表表单。 Although it is very easy to modify the form under SPDesigner, I can't find a way to do the same in VS2008. 尽管在SPDesigner下修改表单非常容易,但在VS2008中我找不到找到相同方法的方法。

Does anyone know the way to customize a form programmatically ? 有谁知道以编程方式自定义表单的方法?

Thank you very much 非常感谢你

The best way to customize newform.asxp and editform.aspx (in my opinion) could be : 定制newform.asxp和editform.aspx的最佳方法(在我看来)可能是:

On a new visual studio solution : 在新的Visual Studio解决方案上:

  • Define your content type for the list 定义列表的内容类型
  • Define a list shema based on the CT 根据CT定义列表shema
  • In the section "forms" in the schema.xml define your own aspx for editform.aspx and newform.aspx like 在schema.xml的“表单”部分中,为editform.aspx和newform.aspx定义自己的aspx,例如

     <Forms> <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\\form.aspx" WebPartZoneID="Main" /> <Form Type="EditForm" Url="EditForm.aspx" SetupPath="features\\$SharePoint.Feature.DeploymentPath$\\YourListDefinitionPathInSolution\\YourEditForm.aspx" UseLegacyForm="True" WebPartZoneID="Main" /> <Form Type="NewForm" Url="NewForm.aspx" SetupPath="features\\$SharePoint.Feature.DeploymentPath$\\YourListDefinitionPathInSolution\\YourEditForm.aspx" UseLegacyForm="True" WebPartZoneID="Main" /> </Forms> 

In this blog post you will find the good recipe : Create custom SharePoint 2010 list form for deployment in a Visual Studio 2010 project 在此博客文章中,您将找到一个很好的秘诀: 创建自定义SharePoint 2010列表表单以在Visual Studio 2010项目中进行部署

Regards 问候

EDIT : sorry, recipe for 2010 version :-( 编辑:对不起,2010年版本的配方:-(

What you are suggesting does not sound like best practice, the newform.aspx, editform.aspx, etc. are the SharePoint out-of-the-box forms for the list and should probably be left alone. 您所建议的听起来不像是最佳实践,newform.aspx,editform.aspx等是列表的SharePoint即用型表单,应该单独使用。

What changes are you making? 您正在进行哪些更改? Simple changes like increasing the size of text boxes or substantial changes? 简单的更改,例如增加文本框的大小还是实质性的更改?

You can create your own forms if the changes are substantial 如果更改很大,则可以创建自己的表单

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

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