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开发中,很有帮助的,很多地方需要他

  • 相关阅读:
    用spring tool suite插件创建spring boot项目时报An internal error occurred during: "Building UI model". com/google/common/
    Eclipse卸载插件SpringSoource-tool-suite
    spring-tool-suite使用教程,并创建spring配置文件
    MySQL获取指定长度的字符串的函数left(s,n)和right(s,n)
    maven web项目配置log4j,及log4j参数设置
    Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'zoneId' in 'class java.lang.String'
    ifconfig 输出里没有IP地址
    maven web项目生成WebContent或WebRoot目录
    Window 命令行神器:cmder
    Filezilla Download for Linux (deb, rpm, txz, xz, amd64, i386, i486, i586, i686, x86_64)
  • 原文地址:https://www.cnblogs.com/masahiro/p/10128289.html
Copyright © 2011-2022 走看看