我写了一个扩展SPFieldLookup的自定义字段。我设置了AllowMultipleValues = true; 这里是现场控制值:Sharepoint自定义SPFieldLookup只保存一个值
public override object Value
{
get
{
EnsureChildControls();
SPFieldLookupValueCollection vals = new SPFieldLookupValueCollection();
ICollection s = TinBaiLienQuanPicker.SelectedIds;
if (s != null && s.Count > 0)
{
foreach (var i in s)
{
ListItem z = availableItems.Find(x => (x.Value == i.ToString()));
if (z != null)
{
vals.Add(new SPFieldLookupValue(int.Parse(z.Value), z.Text));
}
}
}
return vals;
}
set
{
EnsureChildControls();
base.Value = value as SPFieldLookupValueCollection;
}
}
当控制保存现场数据,我看到它返回一个集合其中有多个值。 但是当我再次检索数据时,我只收到第一个值。我从Control Field'ListItemFieldValue属性中获取值。
请给我一个小费。非常感谢你。
嗨,EG。感谢您的回复。 ParentType已被设置为LookupMulti。 – 2009-12-29 06:55:08