SlideShare a Scribd company logo
SharePoint 2010
 Session - 5

By: Usman Zafar Malik
[MCTS: MOSS 2007], [MSCBSS: CRM 3.0 / 4.0], MCP
SharePoint 2010 Development
SharePoint 2010 Development
• Simple Web parts
• Advance Level Web parts
SharePoint 2010 Simple Web parts
Simple Web parts
What are web parts?
• Web Part is also called a Web Widget, is an
  ASP.NET server control which is added to a Web
  Part Zone on Web Part Pages by users at run
  time. It enable end users to modify the content,
  appearance, and behavior of Web pages directly
  from a browser.
Possible scopes
• Site Level.
Simple Web parts
Two types of web parts

• Pure ASP.Net based web parts
  Derived from:- System.Web.UI.WebControls.WebParts.WebPart
   – Generic web parts, that can be used in SharePoint and outside the
     SharePoint domain.

• SharePoint based web parts
  Derived from:- Microsoft.SharePoint.WebPartPages.WebPart
   – Only used in the SharePoint domain.
Simple Web parts
Further Categorization in Web parts

• Web parts
  - A class derived from “Webparts” class

• Visual web parts
  - A class derived from “Webparts” but also contains a
user control in this web part.
  - Can’t be used in sandboxed solutions.
Simple Web parts
Simple Web parts
Simple Web parts
Simple Web parts
Simple Web parts
Define properties in web parts

The WebBrowseable attribute specifies that the decorated property should appear in the editor component
of the web part. It only allows the end user to modify the property and does nothing about persistence.

The Personalizable attribute specifies that the value of the decorated property must be persisted in the
SharePoint backend, either in the user store (by default) or in the shared store (if the Shared scope is
specified). It only cares about persistence and does nothing about the property presence in the editor
component.

So, if you decorate a property with [WebBrowsable] and not [Personalizable], the end user will be able to
modify it in the editor component but its new value won't be persisted.

Conversely, if you decorate a property with [Personalizable] and not [WebBrowsable], its value will be
persisted but the end user won't be allowed to modify it.
Simple Web parts Life Cycle
              OnInit
             OnLoad
        CreateChildControls
           OnPreRender
          SaveViewState
            Site Render
         RenderContents
            OnUnload
             Dispose
Visual Web parts
Visual Web parts
Visual Web parts
Visual Web parts
Visual Web parts Life Cycle            SimpleVisualWebPart - OnInit

                                      SimpleVisualWebPart - OnLoad

                                SimpleVisualWebPart - CreateChildControls

                                  SimpleVisualWebPartUserControl - OnInit

                                 SimpleVisualWebPartUserControl - OnLoad

                               SimpleVisualWebPartUserControl - Page_Load

                                    SimpleVisualWebPart - OnPreRender

                              SimpleVisualWebPartUserControl - OnPreRender

                                   SimpleVisualWebPart - SaveViewState

                              SimpleVisualWebPartUserControl - SaveViewState

                                       SimpleVisualWebPart - Render

                                 SimpleVisualWebPartUserControl - Render
Visual Web parts Life Cycle
                                SimpleVisualWebPart - RenderContents

                              SimpleVisualWebPartUserControl - OnUnload

                               SimpleVisualWebPartUserControl - Dispose

                                   SimpleVisualWebPart - OnUnload

                                    SimpleVisualWebPart - Dispose
SharePoint 2010 Advance Level Web parts
Advance Level Web parts
Advance Level web parts?
• Web part which contains toolpart, or we add
  some custom controls in Web part Editor Tool
  part section.
Advance Level Web parts
Advance Level web parts?
• Web part which contains Custom Webpart Editor Section

• Two ways to create Custom Editor Part / Toolpart of Web
  part
   – By inheriting class from
     “Microsoft.SharePoint.WebPartPages.ToolPart”

   – By Implementing Interface “IWebEditable” on Toolpart class
Advance Level Web parts
Using Toolpart class
Advance Level Web parts
Using Toolpart class
Advance Level Web parts using Toolpart class
Advance Level Web parts using Toolpart class


Three Level of ToolParts
  – WebPartToolPart
  – CustomPropertyToolPart
  – Add Custom ToolPart
Advance Level Web parts using Toolpart class
WebPartToolPart

Default WebPart properties:-

•   Appearance
      –   Title
      –   Width
      –   Frame State
      –   Frame Style
•   Layout
      –   Visible on Page
      –   Direction
      –   Zone
      –   Part Order
•   Advanced
      –   Allow Minimize
      –   Allow Close
      –   Allow Zone Change
      –   Allow Export Sensitive Properties
      –   Detail Link
      –   Description
      –   Help Link
      –   Icon File (Large)
      –   Icon File (Small)
      –   Missing Assembly Error
      –   Target Audiences
Advance Level Web parts using Toolpart class

CustomPropertyToolPart

An additional ToolPart that is added when
custom properties are added to the WebPart
programmatically.

Example:- First Name, Last Name
Advance Level Web parts using Toolpart class

CustomToolPart

A toolpart which you have programmatically
created and want to add in web part editor part.

Example:- Derived Classes from
“Microsoft.SharePoint.WebPartPages.ToolPart”
wants to add in the Web part’s Editor section.
Advance Level Web parts using Toolpart class

public override Microsoft.SharePoint.WebPartPages.ToolPart[] GetToolParts()
{
       PersonDetailsToolPart CustomToolPart_ = new PersonDetailsToolPart();
       CustomToolPart_.Title = "Company Details";

      Microsoft.SharePoint.WebPartPages.ToolPart[] toolParts = new
Microsoft.SharePoint.WebPartPages.ToolPart[3];
      toolParts[0] = new Microsoft.SharePoint.WebPartPages.WebPartToolPart();
      toolParts[1] = new Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart();
      toolParts[2] = CustomToolPart_;

      return toolParts;
}

Override the “GetToolParts()” method in order to add the custom toolpart in to your web part editor
part section.
Advance Level Web parts using Toolpart class
Common Webpart Properties
this.AllowMinimize = true/false
this.AllowHide = true/false;
this.AllowClose = false;
this.ChromeType = PartChromeType.None; (if user
wants to remove the border of the web part )
Advance Level Web parts using IWebEditable Interface
Steps

-   The web part which has the Custom Editor Part must implement the “IWebEditable “interface.

    #region IWebEditable Members

    EditorPartCollection IWebEditable.CreateEditorParts()
    {
      // Adding your custom web part editor part (Example:- CustomEditor)
      List<EditorPart> editors = new List<EditorPart>();
      editors.Add(new CustomEditor());
      return new EditorPartCollection(editors);
    }

    object IWebEditable.WebBrowsableObject
    {
      get { return this; } // what is being edited :- Returning the Web part itself.
    }
    #endregion
Advance Level Web parts using IWebEditable Interface

Steps
- The Custom Editor Webpart must be inherited from
  “EditorPart” class.
- It must overrides two methods.
  1- ApplyChanges
    Used for copy content from Editor Part to Web part.
  2- SyncChanges
   Used for Copy content from Web part to Editor Part.
Q&A
Thanks !

More Related Content

PPTX
Parallelminds.web partdemo1
PPTX
Parallelminds.web partdemo
PPTX
Gabriel Gayhart - XML Pointer File Example
PPSX
03 asp.net session04
PPTX
SharePoint 2013 Hosted App Presentation by Roy Kim
PPS
15 asp.net session22
PPTX
UI Customization in AEM 6.0
PDF
AEM 6.1 User Interface Customization
Parallelminds.web partdemo1
Parallelminds.web partdemo
Gabriel Gayhart - XML Pointer File Example
03 asp.net session04
SharePoint 2013 Hosted App Presentation by Roy Kim
15 asp.net session22
UI Customization in AEM 6.0
AEM 6.1 User Interface Customization

What's hot (20)

PDF
User Interface customization for AEM 6
PDF
CIRCUIT 2015 - Content API's For AEM Sites
PDF
CIRCUIT 2015 - UI Customization in AEM 6.1
PPTX
Build single page applications using AngularJS on AEM
PPTX
User interface customization for aem6 circuit
PPTX
New Features of ASP.NET 4.0
PPTX
SharePoint Hosted Add-in with AngularJS and Bootstrap
PDF
Connections customization lite
PPTX
AEM 6.0 - Author UI Customization & Features
PDF
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
PPTX
Introduction to visualforce
PPTX
Web forms in ASP.net
PPTX
Chanhao Jiang And David Wei Presentation Quickling Pagecache
PDF
Integrating ASP.NET AJAX with SharePoint
PDF
Customize it! Make IBM Connections look your way
DOCX
Visualforce report
PPT
Rails engines
ODP
MAS202 - Customizing IBM Connections - Downloadable
PDF
Social Connections VI — IBM Connections Extensions and Themes Demystified
PDF
Sling Dynamic Include
User Interface customization for AEM 6
CIRCUIT 2015 - Content API's For AEM Sites
CIRCUIT 2015 - UI Customization in AEM 6.1
Build single page applications using AngularJS on AEM
User interface customization for aem6 circuit
New Features of ASP.NET 4.0
SharePoint Hosted Add-in with AngularJS and Bootstrap
Connections customization lite
AEM 6.0 - Author UI Customization & Features
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Introduction to visualforce
Web forms in ASP.net
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Integrating ASP.NET AJAX with SharePoint
Customize it! Make IBM Connections look your way
Visualforce report
Rails engines
MAS202 - Customizing IBM Connections - Downloadable
Social Connections VI — IBM Connections Extensions and Themes Demystified
Sling Dynamic Include
Ad

Viewers also liked (7)

PPTX
Upgrade webcast avoid the mess id
PPT
Intranet design strategies2011 (nx power lite)
PPT
SpaceTech4
PPTX
SharePoint 2010 Training Session 6
PPTX
SharePoint 2010 Training Session 4
PPTX
SharePoint Fundamentals (Lesson 1&2)
PPTX
SharePoint 2010 Training Session 1
Upgrade webcast avoid the mess id
Intranet design strategies2011 (nx power lite)
SpaceTech4
SharePoint 2010 Training Session 6
SharePoint 2010 Training Session 4
SharePoint Fundamentals (Lesson 1&2)
SharePoint 2010 Training Session 1
Ad

Similar to SharePoint 2010 Training Session 5 (20)

PDF
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
PDF
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
PPT
Creating Web Parts New
PPT
Creating Web Parts New
PPT
Creating Web Parts New
PPTX
SharePoint Web part programming
PPTX
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
PPTX
Advanced SharePoint Web Part Development
PPTX
Full Stack_Reac web Development and Application
PPTX
Visualforce
PPSX
15 asp.net session22
PPTX
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
PDF
Build single page applications using AngularJS on AEM
PPTX
Build single page applications using AngularJS on AEM
PDF
SharePoint 2010 Customization Poster
PPTX
Parallelminds.asp.net with sp
PPT
CTTDNUG ASP.NET MVC
PDF
Solving Common Web Component Problems - Simon MacDonald
PDF
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
DOC
WSS MOSS Portfolio
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Creating Web Parts New
Creating Web Parts New
Creating Web Parts New
SharePoint Web part programming
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Advanced SharePoint Web Part Development
Full Stack_Reac web Development and Application
Visualforce
15 asp.net session22
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
SharePoint 2010 Customization Poster
Parallelminds.asp.net with sp
CTTDNUG ASP.NET MVC
Solving Common Web Component Problems - Simon MacDonald
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
WSS MOSS Portfolio

More from Usman Zafar Malik (7)

PPTX
Project Management with Knowledge Areas and AI
PPTX
SharePoint 2010 Training Session 3
PPTX
SharePoint 2010 Training Session 2
PPT
Easy Learning Presentation Moss 2007 Usman
PPT
Easy Learning Presentation Moss 2007 Usman
PPT
Windows Workflow Foundation
PPT
Presentation Moss 2007 Usman
Project Management with Knowledge Areas and AI
SharePoint 2010 Training Session 3
SharePoint 2010 Training Session 2
Easy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 Usman
Windows Workflow Foundation
Presentation Moss 2007 Usman

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
KodekX | Application Modernization Development
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation theory and applications.pdf
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
KodekX | Application Modernization Development
Reach Out and Touch Someone: Haptics and Empathic Computing
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Empathic Computing: Creating Shared Understanding
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation theory and applications.pdf

SharePoint 2010 Training Session 5

  • 1. SharePoint 2010 Session - 5 By: Usman Zafar Malik [MCTS: MOSS 2007], [MSCBSS: CRM 3.0 / 4.0], MCP
  • 3. SharePoint 2010 Development • Simple Web parts • Advance Level Web parts
  • 5. Simple Web parts What are web parts? • Web Part is also called a Web Widget, is an ASP.NET server control which is added to a Web Part Zone on Web Part Pages by users at run time. It enable end users to modify the content, appearance, and behavior of Web pages directly from a browser. Possible scopes • Site Level.
  • 6. Simple Web parts Two types of web parts • Pure ASP.Net based web parts Derived from:- System.Web.UI.WebControls.WebParts.WebPart – Generic web parts, that can be used in SharePoint and outside the SharePoint domain. • SharePoint based web parts Derived from:- Microsoft.SharePoint.WebPartPages.WebPart – Only used in the SharePoint domain.
  • 7. Simple Web parts Further Categorization in Web parts • Web parts - A class derived from “Webparts” class • Visual web parts - A class derived from “Webparts” but also contains a user control in this web part. - Can’t be used in sandboxed solutions.
  • 12. Simple Web parts Define properties in web parts The WebBrowseable attribute specifies that the decorated property should appear in the editor component of the web part. It only allows the end user to modify the property and does nothing about persistence. The Personalizable attribute specifies that the value of the decorated property must be persisted in the SharePoint backend, either in the user store (by default) or in the shared store (if the Shared scope is specified). It only cares about persistence and does nothing about the property presence in the editor component. So, if you decorate a property with [WebBrowsable] and not [Personalizable], the end user will be able to modify it in the editor component but its new value won't be persisted. Conversely, if you decorate a property with [Personalizable] and not [WebBrowsable], its value will be persisted but the end user won't be allowed to modify it.
  • 13. Simple Web parts Life Cycle OnInit OnLoad CreateChildControls OnPreRender SaveViewState Site Render RenderContents OnUnload Dispose
  • 18. Visual Web parts Life Cycle SimpleVisualWebPart - OnInit SimpleVisualWebPart - OnLoad SimpleVisualWebPart - CreateChildControls SimpleVisualWebPartUserControl - OnInit SimpleVisualWebPartUserControl - OnLoad SimpleVisualWebPartUserControl - Page_Load SimpleVisualWebPart - OnPreRender SimpleVisualWebPartUserControl - OnPreRender SimpleVisualWebPart - SaveViewState SimpleVisualWebPartUserControl - SaveViewState SimpleVisualWebPart - Render SimpleVisualWebPartUserControl - Render
  • 19. Visual Web parts Life Cycle SimpleVisualWebPart - RenderContents SimpleVisualWebPartUserControl - OnUnload SimpleVisualWebPartUserControl - Dispose SimpleVisualWebPart - OnUnload SimpleVisualWebPart - Dispose
  • 20. SharePoint 2010 Advance Level Web parts
  • 21. Advance Level Web parts Advance Level web parts? • Web part which contains toolpart, or we add some custom controls in Web part Editor Tool part section.
  • 22. Advance Level Web parts Advance Level web parts? • Web part which contains Custom Webpart Editor Section • Two ways to create Custom Editor Part / Toolpart of Web part – By inheriting class from “Microsoft.SharePoint.WebPartPages.ToolPart” – By Implementing Interface “IWebEditable” on Toolpart class
  • 23. Advance Level Web parts Using Toolpart class
  • 24. Advance Level Web parts Using Toolpart class
  • 25. Advance Level Web parts using Toolpart class
  • 26. Advance Level Web parts using Toolpart class Three Level of ToolParts – WebPartToolPart – CustomPropertyToolPart – Add Custom ToolPart
  • 27. Advance Level Web parts using Toolpart class WebPartToolPart Default WebPart properties:- • Appearance – Title – Width – Frame State – Frame Style • Layout – Visible on Page – Direction – Zone – Part Order • Advanced – Allow Minimize – Allow Close – Allow Zone Change – Allow Export Sensitive Properties – Detail Link – Description – Help Link – Icon File (Large) – Icon File (Small) – Missing Assembly Error – Target Audiences
  • 28. Advance Level Web parts using Toolpart class CustomPropertyToolPart An additional ToolPart that is added when custom properties are added to the WebPart programmatically. Example:- First Name, Last Name
  • 29. Advance Level Web parts using Toolpart class CustomToolPart A toolpart which you have programmatically created and want to add in web part editor part. Example:- Derived Classes from “Microsoft.SharePoint.WebPartPages.ToolPart” wants to add in the Web part’s Editor section.
  • 30. Advance Level Web parts using Toolpart class public override Microsoft.SharePoint.WebPartPages.ToolPart[] GetToolParts() { PersonDetailsToolPart CustomToolPart_ = new PersonDetailsToolPart(); CustomToolPart_.Title = "Company Details"; Microsoft.SharePoint.WebPartPages.ToolPart[] toolParts = new Microsoft.SharePoint.WebPartPages.ToolPart[3]; toolParts[0] = new Microsoft.SharePoint.WebPartPages.WebPartToolPart(); toolParts[1] = new Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart(); toolParts[2] = CustomToolPart_; return toolParts; } Override the “GetToolParts()” method in order to add the custom toolpart in to your web part editor part section.
  • 31. Advance Level Web parts using Toolpart class Common Webpart Properties this.AllowMinimize = true/false this.AllowHide = true/false; this.AllowClose = false; this.ChromeType = PartChromeType.None; (if user wants to remove the border of the web part )
  • 32. Advance Level Web parts using IWebEditable Interface Steps - The web part which has the Custom Editor Part must implement the “IWebEditable “interface. #region IWebEditable Members EditorPartCollection IWebEditable.CreateEditorParts() { // Adding your custom web part editor part (Example:- CustomEditor) List<EditorPart> editors = new List<EditorPart>(); editors.Add(new CustomEditor()); return new EditorPartCollection(editors); } object IWebEditable.WebBrowsableObject { get { return this; } // what is being edited :- Returning the Web part itself. } #endregion
  • 33. Advance Level Web parts using IWebEditable Interface Steps - The Custom Editor Webpart must be inherited from “EditorPart” class. - It must overrides two methods. 1- ApplyChanges Used for copy content from Editor Part to Web part. 2- SyncChanges Used for Copy content from Web part to Editor Part.
  • 34. Q&A