查找值无效,保存选择类型

时间:2011-08-09 10:58:45

标签: c#-4.0 sharepoint-2010 multiple-choice

我在listdefination中有一个字段类型选择

 <Field Type="Choice"
         DisplayName="Department Name"
         Required="False"
         NumLines="6"
         Sortable="TRUE"
         EnforceUniqueValues = "False"
         ShowInNewForm="TRUE" ShowInEditForm="TRUE"
         ID="{707D5193-13BE-4077-8009-224CD970646B}"
         StaticName="DepartmentName"
         Name="DepartmentName"
         Group="Department Name" >
         <CHOICES>
            <CHOICE>Accounts</CHOICE>
            <CHOICE>Admin</CHOICE>
            <CHOICE>HR</CHOICE>
            <CHOICE>Operations</CHOICE>
            <CHOICE>Engineering</CHOICE>
            <CHOICE>Marketing</CHOICE>
            <CHOICE>Operations</CHOICE>
           <CHOICE>Other</CHOICE>
         </CHOICES>
     </Field> 

我已覆盖默认的新表格并编码为

 <SharePoint:FormField 
           ID="ff_Department" 
           runat="server" 
           ControlMode="New" 
           FieldName="DepartmentName" >
 </SharePoint:FormField>

现在在保存数据时我使用

获得了它的值
 ff_Department.Value.ToString()

现在使用

将其值保存到列表中
  item["DepartmentName"] = ff_Department.Value.ToString();

它抛出错误

Invalid look-up value.
A look-up field contains invalid data. Please check the value and try again.

任何想法?

0 个答案:

没有答案