更改共享点中是/否字段的值

Imi*_*xha 2 sharepoint-2010

我的共享点列表中有一个是/否(复选框)类型的字段。我试图以编程方式(服务器代码)更改/设置字段的值,但是它给我一个错误,提示它应为1或0。我无法使其正常工作。谁能帮我吗?

这部分代码:

 SPListItem item = reportList.Items.Add();
                item["RequesterID"] = id;

                 **item["ZIP_x0020_Code_x0020_Linked"] = 0;**

                item["ZC_x0020_code"] = txtZcCode.Text;
                item.Update();
Run Code Online (Sandbox Code Playgroud)

Gar*_*ger 5

对于是/否字段,应将其设置为“ 1”或“ 0”:

item["ZIP_x0020_Code_x0020_Linked"] = "0";
Run Code Online (Sandbox Code Playgroud)

在这里查看更多信息:

http://blog.henryong.com/2008/12/05/programmatically-setting-the-default-value-of-a-spfieldboolean-field/