Sharepoint 如何将数据从ToolPart1类发送到WebPart1类

Sharepoint 如何将数据从ToolPart1类发送到WebPart1类,sharepoint,Sharepoint,我无法将数组数据从ToolPart发送到WebPart,尽管字符串数据是oke。我调试并知道语句代码webpart.ListColumns[I]=lstBoxSend.Items[I]。值是正确的,并且有数据,但我不知道为什么webpart中的属性ListColumns为null public class ToolPart1 : Microsoft.SharePoint.WebPartPages.ToolPart { public override

我无法将数组数据从ToolPart发送到WebPart,尽管字符串数据是oke。我调试并知道语句代码webpart.ListColumns[I]=lstBoxSend.Items[I]。值是正确的,并且有数据,但我不知道为什么webpart中的属性ListColumns为null

public class ToolPart1 : Microsoft.SharePoint.WebPartPages.ToolPart
         {
              public override void ApplyChanges()
                 {
                   base.ApplyChanges();
                   var webpart = (WebPart1)this.ParentToolPane.SelectedWebPart;
                   webpart.SiteUrl = txtURL.Text;
                   webpart.ListName = ddlList.SelectedValue;

                   if (webpart.ListColumns == null)
                     {
                       webpart.ListColumns = new string[lstBoxSend.Items.Count];
                     }
                   for (int i = 0; i < lstBoxSend.Items.Count; i++)
                     {
                       webpart.ListColumns[i] = lstBoxSend.Items[i].Value;
                     }
                  }
          }
    public class WebPart1 : Microsoft.SharePoint.WebPartPages.WebPart
    {

        public string SiteUrl { get; set; }
        public string ListName { get; set; }
        public string[] ListColumns { get; set; }

   }
公共类工具部分1:Microsoft.SharePoint.WebPartPages.ToolPart
{
公共覆盖无效ApplyChanges()
{
base.ApplyChanges();
var webpart=(WebPart1)this.ParentToolPane.SelectedWebPart;
webpart.SiteUrl=txtURL.Text;
webpart.ListName=ddlList.SelectedValue;
如果(webpart.ListColumns==null)
{
webpart.ListColumns=新字符串[lstBoxSend.Items.Count];
}
对于(int i=0;i

我想从ToolPart接收Web部件中的数组数据

覆盖ApplyChanges以将数据发送到Web部件,请选中


我想接收ToolPart1发送的WebPart1中的数组字符串[]ListColumns。
public override void ApplyChanges()
    {
        int i = 0;
        WebPartCustom1 wpCustom = (WebPartCustom1)this.ParentToolPane.SelectedWebPart;
        int.TryParse(_itensToolPart.Text, out i);
        wpCustom.MyInt = i;
        wpCustom.MyString = _titleToolPart.Text;
        wpCustom.MyGuid = _ddlToolPart.SelectedItem.Value;      
    }