在SharePoint Web部件中使用C#代码

在SharePoint Web部件中使用C#代码,sharepoint,sharepoint-2013,web-parts,sharepoint-online,Sharepoint,Sharepoint 2013,Web Parts,Sharepoint Online,我在SharePoint 2010 Web部件中使用了以下C#代码来获取我的配置设置 string _configInfo; [Personalizable(PersonalizationScope.Shared), WebBrowsable(false)] public string ConfigInfo { get { return this._configInfo; } set { this._configInfo =

我在SharePoint 2010 Web部件中使用了以下C#代码来获取我的配置设置

string _configInfo;
[Personalizable(PersonalizationScope.Shared), WebBrowsable(false)]
public string ConfigInfo
{
    get
    {
        return this._configInfo;
    }
    set
    {
        this._configInfo = value;
    }
}

private HiddenField sourceListConfig;
protected override void CreateChildControls()
{
    this.sourceListConfig = new HiddenField();
    sourceListConfig.ID = "SourceListConfigID";
    sourceListConfig.Value = this.ConfigInfo;
    this.sourceListConfig.ValueChanged += new EventHandler(sourceListConfig_ValueChanged);
    this.Controls.Add(sourceListConfig);

    base.CreateChildControls();
}

void sourceListConfig_ValueChanged(object sender, EventArgs e)
{
    this.ConfigInfo = this.sourceListConfig.Value;
    this.SetPersonalizationDirty();
}
服务器端编码仅限于最新版本的SharePoint。那么,我如何在最新版本的SharePoint(如2013/2016)中为我的Web部件实现这一点呢

在Web部件的“Elements.xml”中有一个“Properties”,我们可以在Web部件配置中使用它。但是,我有很多控件来掌握它的价值。所以,我不能用那个。相反,我使用了一个长字符串来保存webpart控件的值。例如,我有10个复选框,我会将这些值保存在该字符串中,并在更改时进行更新。我只是使用复选框只是为了理解,而且我在我的Web部件中使用了50多个控件

最新版本的SharePoint中推荐的选项是什么