[英]Changing “required” property of a field in SharePoint 2010 custom Newform.aspx
I have created a custom newform.aspx by cloning the form generated by SharePoint Designer and added it to a VS2010 project. 我通过克隆SharePoint Designer生成的表单创建了一个自定义的newform.aspx,并将其添加到VS2010项目中。 Everything seems to be working fine like setting the value etc... but I couldn't figure out how to set the
Required
property of a field. 一切似乎都可以正常工作,例如设置值等。但是我不知道如何设置字段的
Required
属性。
Based on a certain condition I would like to set the required property of a field to true or false. 根据特定条件,我想将字段的必需属性设置为true或false。
I am accessing the controls using CompositeField
and BaseFieldControl
but they dont seem to give a handle to set required property value. 我正在使用
CompositeField
和BaseFieldControl
访问控件,但是它们似乎没有提供设置所需属性值的句柄。
Any pointers are greatly appreciated. 任何指针,不胜感激。
您可以设置AllowBlank
内物品的属性(如TextField
的)的CompositeField
至真/假。
通过抓住以下属性而不是进入控件来设法找到解决方案。
objListFormWebPart.ItemContext.Fields["fieldDisplayName"].Required = false;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.