zoukankan      html  css  js  c++  java
  • SharePoint2010自定义工具栏

    相信大家对自定义工具栏很有兴趣吧,在家里研究拉一下,把自己的代码给贴出来,给大家喜欢研究MOSS的哥们研究,研究 , 其实就是继承一个编辑类就OK拉,这个自定义工具栏,在实际的MOSS开发中,很有帮助的,很多地方需要他。。

    //这个类是工具栏的编辑类,工具栏 ,主要靠他
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint.WebControls;
    namespace WebPartDemo { public class MyEditor : EditorPart     {       public MyEditor()       {          this.Title = "Custom Editor";       }
          
    private PeopleEditor selPeople;
          
    protected override void CreateChildControls()       {          selPeople = new PeopleEditor();          Controls.Add(selPeople);       }
          
    public override bool ApplyChanges()       {          EnsureChildControls();          (WebPartToEdit as WebPartDemo).DefaultTitle = selPeople.CommaSeparatedAccounts;          return true;       }
          
    public override void SyncChanges()       {          EnsureChildControls();          selPeople.CommaSeparatedAccounts = (WebPartToEdit as WebPartDemo).DefaultTitle;       }    } }

    下面就是在我们的实际的运用中,运用到他,代码测试过,可以直接运用。

    using System;
    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Serialization;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;
    using System.Collections.Generic;
    namespace WebPartDemo {    [Guid("f7145e12-c25e-419f-90bd-ffe928ba084d")]    public class WebPartDemo : System.Web.UI.WebControls.WebParts.WebPart    {       public WebPartDemo()       {          this.ExportMode = WebPartExportMode.All;       }
          
    private string _defaultTitle;
          [Personalizable(), WebBrowsable(),       WebDisplayName(
    "默认标题"), WebDescription("列表项的默认标题"),       SPWebCategoryName("新建设置")]       public string DefaultTitle       {          get { return _defaultTitle; }          set { _defaultTitle = value; }       }
          
    private bool _customBool;       [Personalizable(), WebBrowsable()]       public bool CustomBool       {          get { return _customBool; }          set { _customBool = value; }       }
          
    private TextBox input;       private Button btn;       //编辑类主要靠这里的。。相信大家看看就明白啦       public override EditorPartCollection CreateEditorParts()       {          List<EditorPart> list = new List<EditorPart>();(范性)          MyEditor me = new MyEditor();          me.ID = this.ID + "_me";          list.Add(me);          return new EditorPartCollection(list);       }
          
    protected override void CreateChildControls()       {          input = new TextBox();          Controls.Add(input);          btn = new Button();          btn.Text = "Add!";          btn.Click += new EventHandler(btn_Click);          Controls.Add(btn);       }       protected override void OnPreRender(EventArgs e)       {          input.Text = this.DefaultTitle;       }       void btn_Click(object sender, EventArgs e)       {          if (Page.IsValid)          {             this.DefaultTitle = input.Text;             this.SetPersonalizationDirty();          }       } } }

    希望对MOSS开发的哥们有帮助,其实开发就是要多练习列子。。大家一起加油吧!

    相信大家对自定义工具栏很有兴趣吧,在家里研究拉一下,把自己的代码给贴出来,给大家喜欢研究MOSS的哥们研究,研究 , 其实就是继承一个编辑类就OK拉,这个自定义工具栏,在实际的MOSS开发中,很有帮助的,很多地方需要他

  • 相关阅读:
    [转载]试着解析宾得为何不出全幅
    [转载]试着解析宾得为何不出全幅
    [转载]从KX、KR用户的购镜选择谈到K5和其他
    [转载]从KX、KR用户的购镜选择谈到K5和其他
    pdf工具的使用
    Xshell 添加快速命令使用
    linux remove和 rename函数使用
    linear correlation coefficient|Correlation and Causation|lurking variables
    SST|SSR|SSE| r 2|与Sx x &Sx y & Syy的关系|
    the least-squares criterion|Sxx|Sxy|Syy|Regression Equation|Outliers|Influential Observations|curvilinear regression|linear regression
  • 原文地址:https://www.cnblogs.com/masahiro/p/10128289.html
Copyright © 2011-2022 走看看