在我的自定义表单中,我想显示一个自定义的Guid字段。
我通过功能创建了该字段的常规方式:
我可以帮您进行翻译。这段内容涉及IT技术,您需要通过代码设置并在表单上显示此字段。对于表单,我有以下控件(仅供参考,还包括标题字段):
我通过功能创建了该字段的常规方式:
<Field ID="88813c02-799b-4fc8-8ed8-72fe668e257c" Type="Guid"
Name="myGuid"
StaticName="myGuid"
DisplayName="My Guid" />
我可以帮您进行翻译。这段内容涉及IT技术,您需要通过代码设置并在表单上显示此字段。对于表单,我有以下控件(仅供参考,还包括标题字段):
<SharePoint:GuidField runat="server" ID="myGuidField" FieldName="myGuid" />
<SharePoint:TextField runat="server" ID="myTitle" FieldName="Title" />
在常规的新建/编辑表单中,Guid字段不会显示 - 它只是空的。在自定义表单的代码后台中,我可以执行以下操作:
myTitle.Value = "Some Title Value";
string testValue = myTitle.Value; //-->"Some Title Value"
但是在尝试设置Guid字段的值时,却无法完成:
string anotherValue = myGuidField.Value; //--> null
Guid myGuid = new Guid("7f824c3f-4049-4034-a231-85291fce2680");
myGuidField.Value = myGuid;
string anotherValue = myGuidField.Value; //--> still null
//but myGuidField is seen as a "Microsoft.Sharepoint.WebControls.GuidField"
我无法通过编程设置Guid值,也无法仅显示Guid。
两个问题:
- 如何在表单上显示GuidField(它包含的GUID)?
- 如何设置GuidField的值?