可以使用复选框数据绑定的 SharePoint 列表项吗?
在 SharePoint 中,我可以设置与编辑字段的绑定,如下所示。当表单回发时,更改会自动保留到底层列表项。
<PublishingWebControls:RichHtmlField ID="Field1" FieldName="MySPListItemFieldName" ...
因此,这对于 RichHtmlFields 非常有用,但是假设我在同一列表项中有一个是/否(布尔)字段,是否有类似的构造以类似的方式将该字段绑定到复选框控件?
我的目标是不必扔下一行 c# 来将控件的值传输到字段,我希望它像 RichHtmlField 一样是自动的。似乎必须有一种直接的方法来执行此操作,因为 SharePoint 通过其内部列表项编辑页面 (EditForm.aspx) 自行完成此操作。
In SharePoint I can tee up a binding to an edit field like this below. When the form posts back the changes are automatically persisted to the underlying list item.
<PublishingWebControls:RichHtmlField ID="Field1" FieldName="MySPListItemFieldName" ...
So this works great for RichHtmlFields, but say I've got a Yes/No (boolean) field in the same list item, is there a similar construct to bind that field to a check box control in a similar way?
My goal is to not have to throw down a line of c# to transfer the value of the control to the field, I want it to be automatic like RichHtmlField. It seems like there has to be a straight forward way of doing this since SharePoint does this itself with its internal list item editing page (EditForm.aspx).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要的是表单上的 BooleanField 控件:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.booleanfield.aspx
只需将 FieldName 设置为“是/否”列的字段名称,应该可以正常工作。
What you're after is a BooleanField control on your form:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.booleanfield.aspx
Just set the FieldName to that of your Yes/No column, should work fine.