SlideShare uma empresa Scribd logo
1 de 35
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 !

Mais conteúdo relacionado

Mais procurados

User interface customization for aem6 circuit
User interface customization for aem6 circuitUser interface customization for aem6 circuit
User interface customization for aem6 circuit
Damien Antipa
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0
Buu Nguyen
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Ajax Experience 2009
 

Mais procurados (20)

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

Destaque (7)

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

Semelhante a SharePoint 2010 Training Session 5

Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
LiquidHub
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
LiquidHub
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
LiquidHub
 
SharePoint Web part programming
SharePoint Web part programmingSharePoint Web part programming
SharePoint Web part programming
Quang Nguyễn Bá
 
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
AX2012 Technical Track -  Entreprise portal, Czesia LangoswkaAX2012 Technical Track -  Entreprise portal, Czesia Langoswka
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
dynamicscom
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
connectwebex
 
SharePoint 2010 Customization Poster
SharePoint 2010 Customization PosterSharePoint 2010 Customization Poster
SharePoint 2010 Customization Poster
brendonschwartz
 

Semelhante a SharePoint 2010 Training Session 5 (20)

Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
 
Creating Web Parts New
Creating Web Parts NewCreating Web Parts New
Creating Web Parts New
 
SharePoint Web part programming
SharePoint Web part programmingSharePoint Web part programming
SharePoint Web part programming
 
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
Visualforce
VisualforceVisualforce
Visualforce
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
 
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
AX2012 Technical Track -  Entreprise portal, Czesia LangoswkaAX2012 Technical Track -  Entreprise portal, Czesia Langoswka
AX2012 Technical Track - Entreprise portal, Czesia Langoswka
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
SharePoint 2010 Customization Poster
SharePoint 2010 Customization PosterSharePoint 2010 Customization Poster
SharePoint 2010 Customization Poster
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
Solving Common Web Component Problems - Simon MacDonald
Solving Common Web Component Problems - Simon MacDonaldSolving Common Web Component Problems - Simon MacDonald
Solving Common Web Component Problems - Simon MacDonald
 
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsGet your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
 
WSS MOSS Portfolio
WSS MOSS PortfolioWSS MOSS Portfolio
WSS MOSS Portfolio
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 

Mais de Usman Zafar Malik

SharePoint 2010 Training Session 3
SharePoint 2010 Training Session 3SharePoint 2010 Training Session 3
SharePoint 2010 Training Session 3
Usman Zafar Malik
 
SharePoint 2010 Training Session 2
SharePoint 2010 Training Session 2SharePoint 2010 Training Session 2
SharePoint 2010 Training Session 2
Usman Zafar Malik
 
Easy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 UsmanEasy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
Easy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 UsmanEasy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
Presentation Moss 2007 Usman
Presentation Moss 2007 UsmanPresentation Moss 2007 Usman
Presentation Moss 2007 Usman
Usman Zafar Malik
 

Mais de Usman Zafar Malik (6)

SharePoint 2010 Training Session 3
SharePoint 2010 Training Session 3SharePoint 2010 Training Session 3
SharePoint 2010 Training Session 3
 
SharePoint 2010 Training Session 2
SharePoint 2010 Training Session 2SharePoint 2010 Training Session 2
SharePoint 2010 Training Session 2
 
Easy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 UsmanEasy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 Usman
 
Easy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 UsmanEasy Learning Presentation Moss 2007 Usman
Easy Learning Presentation Moss 2007 Usman
 
Windows Workflow Foundation
Windows Workflow FoundationWindows Workflow Foundation
Windows Workflow Foundation
 
Presentation Moss 2007 Usman
Presentation Moss 2007 UsmanPresentation Moss 2007 Usman
Presentation Moss 2007 Usman
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

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