从 .NET 控件获取值到 SharePoint 列表

Get values from .NET controls to SharePoint List

我可以知道如何从 .NET 前端控制字段中检索值以存储在 SharePoint 列表中吗?

Field1: TextBox type

Field2: DropDownList type

Field3: checkbox type

下面是我对 textbox type 字段的尝试:

item["Field1"] = (Field1.ToString());

请问我可以检索 DDLCB 值吗?

通过 CSOM 将数据保存到 SharePoint 的示例演示。

<div>
            <asp:TextBox ID="Field1" runat="server"></asp:TextBox>
            <asp:DropDownList ID="Field2" runat="server">
                <asp:ListItem Text="A" Value="A"></asp:ListItem>
                <asp:ListItem Text="B" Value="B"></asp:ListItem>
                <asp:ListItem Text="C" Value="C"></asp:ListItem>
            </asp:DropDownList>
            <asp:CheckBox ID="Field3" runat="server"></asp:CheckBox>
        </div>
        <asp:Button ID="Button1" OnClick="btn_Save" runat="server" Text="Button" />


using (ClientContext clientContext = new ClientContext("http://sp:12001/"))
            {
                clientContext.Credentials = new NetworkCredential("lee","pw","domain");
                Web web = clientContext.Web;
                List oList = clientContext.Web.Lists.GetByTitle("MyList3");
                ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
                Microsoft.SharePoint.Client.ListItem oListItem = oList.AddItem(itemCreateInfo);
                oListItem["Title"] = Field1.Text;
                oListItem["Field2"] = Field2.SelectedItem.Value;
                oListItem["Field3"] = Field3.Checked;
                oListItem.Update();

                clientContext.ExecuteQuery();
            }