ASP.NET
  Home arrow ASP.NET arrow Page 3 - Manipulating Web Parts in ASP.Net 2.0
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Manipulating Web Parts in ASP.Net 2.0
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2005-12-05

    Table of Contents:
  • Manipulating Web Parts in ASP.Net 2.0
  • Editing Web Parts
  • The Web Part Catalog
  • Web Part Connections

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Manipulating Web Parts in ASP.Net 2.0 - The Web Part Catalog


    (Page 3 of 4 )

    The driving factors behind web parts are personalization and customization. With that in mind, there are going to be two very common scenarios with pages containing web parts:

    1. You have ten available web parts, but only five are suitable for general consumption. The other five are more specialized, so you leave them hidden by default, so that people only have to add them if they decide they’re relevant.

    2. People ‘close’ a web part or two. Then later, they decide they’d like to have them both.

    Microsoft has made it very simple to take care of these scenarios from the developer’s perspective as well as the end user. They created the concept of the ‘Catalog Zone’, where information about all available web parts – including ones closed by the users – is stored. At run time, a user can simply click ‘Personalize this Page > Add Web Parts To This Page’ to bring up the catalog.

    Of course we can’t get away with no code whatsoever, but it’s pretty minimal nonetheless. Here is all the code necessary to enable the functionality I just mentioned:

    <asp:CatalogZone runat=”server” HeaderText=”Customize this page”>
     <ZoneTemplate>
      <asp:PageCatalogPart runat=”server”
    title=” your parts” />
      <asp:declarativeCatalogPart runat=”server”
    title=”also available”>
       <webpartstemplate>
        <jc:mathPart runat=”server” id=”otherPart1” />
        <jc:dogPart runat=”server” id=”otherPart2” />
    </webpartstemplate>
      </asp:declarativeCatalogPart>
    </ZoneTemplate>
    </asp:CatalogZone>

    So the PagePartCatalog is the placeholder for any default web parts that have been removed, or ‘closed’, by the user. The DeclarativeCatalogPart is where you manually specify any additionally available web parts, which will be instantiated only after a user adds them to the page.

    And of course, this would not be a full Microsoft offering if we weren’t able to customize the rendering to our liking. Here are the available display properties to modify:

    • CatalogItemStyle

    • HeaderStyle

    • HeaderVerbStyle

    • InstructionStyle

    • PartLinkStyle

    • VerbStyle

    So go ahead, set up a catalog, modify its display, Microsoft has made it incredibly easy to do so. The fun part comes now, as we try to communicate data between separate web parts.

    More ASP.NET Articles
    More By Justin Cook


       · hope you enjoy the article!
       · Hello, Could you please provide an example of using custom provider for web...
     

    ASP.NET ARTICLES

    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...
    - Building an In-Text Advertising System Under...
    - Developing a Mini ASP.NET AJAX Server Centri...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT