现有项目由 EditForm.aspx 编辑,而不是来自 newform.aspx
您必须复制 newform.aspx 并将其命名为 editform.aspx(可以创建一个 displayform.aspx)。
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomDisplay.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomEdit.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomNew.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
</Forms>
对于每个表单,每个 SharePoint 表单字段都必须使用正确的控制模式进行标记
新表格:
<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="New" FieldName="YourFieldName" />
编辑表格:
<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="Edit" FieldName="YourFieldName" />
显示形式:
<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="Display" FieldName="YourFieldName" />