Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint Web部件属性/富文本框?_Sharepoint_Properties_Web Parts - Fatal编程技术网

Sharepoint Web部件属性/富文本框?

Sharepoint Web部件属性/富文本框?,sharepoint,properties,web-parts,Sharepoint,Properties,Web Parts,是否可以使用富文本框(能够使用粗体等)使web部件属性中的字符串可编辑 更新/解决方案 第一个类是应该出现在工具栏中的“自定义属性” using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint.WebControls; using System.Web.UI.WebControls.We

是否可以使用富文本框(能够使用粗体等)使web部件属性中的字符串可编辑

更新/解决方案

第一个类是应该出现在工具栏中的“自定义属性”

   using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint;    
    namespace MyCustomProperty
    {
        public class RichTextToolbarProperty : Microsoft.SharePoint.WebPartPages.ToolPart
        {

            InputFormTextBox textBox;
            Panel toolPartPanel;

            protected override void CreateChildControls()
            {
                toolPartPanel = new Panel();
                toolPartPanel.GroupingText = "Default text here";
                textBox = new InputFormTextBox();
                textBox.TextMode = TextBoxMode.MultiLine;
                textBox.Rows = 10;
                textBox.RichText = true;
                textBox.RichTextMode = SPRichTextMode.FullHtml;

                BasePublicationWebPart wp = (BasePublicationWebPart)this.ParentToolPane.SelectedWebPart;
                textBox.Text = wp.DefaultText;

                toolPartPanel.Controls.Add(textBox);
                Controls.Add(toolPartPanel);
                base.CreateChildControls();
            }

            public override void ApplyChanges()
            {
                BasePublicationWebPart wp = (BasePublicationWebPart)this.ParentToolPane.SelectedWebPart;
                wp.DefaultText = textBox.Text;
            }

        }
    }
第二类是Web部件:

using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;

using System.ComponentModel;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;

namespace MyWebPart
{

    public abstract class BasePublicationWebPart : Microsoft.SharePoint.WebPartPages.WebPart
{

        public string DefaultText
        {
            get
            {
                return _defaultText;
            }
            set { _defaultText = value; }
        }

        public override ToolPart[] GetToolParts()
        {

            ToolPart[] allToolParts = new ToolPart[3];
            WebPartToolPart standardToolParts = new WebPartToolPart();
            CustomPropertyToolPart customToolParts = new CustomPropertyToolPart(); 

            allToolParts[0] = standardToolParts;
            allToolParts[1] = customToolParts;
            allToolParts[2] = new MyCustomProperty.RichTextToolbarProperty(); 

            return allToolParts;
        }
// ... some usual web part code should go here ... ///

是的,您可能需要检查“自定义内容编辑器Web部件”是如何构建的:

我找到了其他有用的链接:以及