Creating Web Parts New
Upcoming SlideShare
Loading in...5

Creating Web Parts New






Total Views
Views on SlideShare
Embed Views



1 Embed 5 5



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Hi Wpf team Questions strat V1 Wfc No idea

Creating Web Parts New Creating Web Parts New Presentation Transcript

  • Creating Web Parts
  • Agenda
    • Web Part (Base class)
      • An ASP.NET web control
      • Browser Rendering
      • Rendering in non-browser clients
      • Overriding events
    • Web Part Properties
      • Introduction
      • Property attributes
      • Saving properties
  • Agenda (Contd.)
    • Creating a simple ‘Hello World’ Web Part, with a custom property
      • Demo
    • Tool parts
      • Introduction
      • Methods
      • Demo
  • Agenda (Contd.)
    • Part to part connections
      • Introduction
      • Interfaces
    • Extending the framework
      • Builders
      • Web Part menus
      • Tool pane
    • Web Part Caching
      • Introduction
  • Web Part (Base class)
    • Web Parts are ASP.NET Web Controls
      • WebPart (base class) derives from System.Web.UI.Control
      • Like all controls they participate in:
        • Page rendering
        • Property settings
        • Post-back events
        • State management
    Web Part = ASP.NET Web Control
  • Web Part (Base class) (Contd.)
    • Browser Rendering
      • The base class Render() method can’t be overridden. The base class uses this to render the chrome, title and web part menu
      • Custom Web Parts need to implement the RenderWebPart() method to render custom Html
  • Web Part (Base class) (Contd.)
    • Browser Rendering (Contd.)
    ASPX Page Web Part WebPart.Render() CustomPart.RenderWebPart() ASP.NET starts page render Request
  • The Web Part base class (Contd.)
    • Rendering in non-browser clients
      • IDesignTimeHtmlProvider interface is used to obtain the rendering for the web part when added to page in clients like FrontPage
      • IDesignTimeHtmlProvider consists of one method: GetDesignTimeHtml
      • Not implemented by default
  • The Web Part base class (Contd.)
    • Overriding Events
      • The following ASP.Net events are sealed:
        • OnInit , OnDataBinding , OnLoad, OnPreRender, OnUnload
        • To subscribe to these events the developer will use:
        • this.Load += new EventHandler (myLoadEvent);
  • Web Part Properties
    • Introduction
      • Web Parts have ‘properties’ that help the user define their behavior
      • Two kinds of properties:
        • Base class properties
        • Custom properties
      • All properties must be serializable through the XMLSerializer
      • Property attributes define property behavior
  • Web Part Properties (Contd.)
    • Property attributes
      • Browsable (.Net)
      • Category (.Net)
      • Description (.Net)
      • - Etc. -
      • FriendlyName (Web Part Framework)
      • HtmlDesigner (Web Part Framework)
      • WebPartStorage (Web Part Framework)
      • - Etc. -
  • Web Part Properties (Contd.)
    • Saving Properties
      • Properties are serialized and stored in the database
      • Stored in two contexts:
        • Shared
        • Personal
      • Storage is controlled by the WebPartStorage attribute:
        • WebPartStorage = Storage.Shared
        • WebPartStorage = Storage.Personal
        • WebPartStorage = Storage.None
  • Creating a simple ‘Hello World’ Web Part, with a custom property
  • Tool parts
    • An Introduction
      • Also derive from Web Controls and should be used to add custom functionality to the tool pane
      • Differ from web parts
        • No mobility
        • Limited base class property set
        • No property storage
        • Render only in the tool pane
      • Rendering process similar to web parts
        • ToolPart.Render cannot be overridden
        • Implement RenderToolPart
  • Tool parts (Contd.)
    • Important Methods
      • ToolPart.ApplyChanges()
        • Called when the user clicks Apply/ Ok on the property sheet
      • ToolPart.CancelChanges()
        • Called when the user clicks Cancel on the property sheet
      • ToolPart.SyncChanges()
        • Called when the tool part needs to refresh itself. (example: after another tool part has saved properties)
      • WebPart.GetToolParts
        • Method on the web part base class
        • Used to associate tool parts with web parts
  • Creating a custom tool part
  • Part to part connections
    • An Introduction
      • Allows Web Parts to send & received basic types of data; e.g. Cell, Row, List, etc.
      • Uses standardized set of interfaces
      • Allows completely independent parts to connect
      • Enables end users to form connections
        • Browser
        • FrontPage
  • Part to part connections (Contd.) My Web Part Page
  • Part to part connections (Contd.)
    • Interfaces
      • ICellProvider, ICellConsumer
      • IRowProvider, IRowConsumer
      • IListProvider, IListConsumer
      • IFilterProvider, IFilterConsumer
      • IParametersOutProvider, IParametersOutConsumer
      • IParametersInProvider, IParametersInConsumer