ASP.NET
  Home arrow ASP.NET arrow Page 3 - Using 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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

Using Web Parts in ASP.Net 2.0
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 14
    2005-11-28

    Table of Contents:
  • Using Web Parts in ASP.Net 2.0
  • Web Parts Explained
  • Properties
  • Changing the Layout

  • 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


    Using Web Parts in ASP.Net 2.0 - Properties


    (Page 3 of 4 )

    So that’s the ultimate basic implementation of web parts, but we have a number of properties available to us to modify the appearance and behavior of the web part. They are:

    • AllowClose
    • AllowEdit
    • AllowHide
    • AllowMinimize
    • AllowZoneChange
    • Caption
    • ChromeState
    • ChromeType
    • Description
    • Direction
    • HelpMode
    • HelpUrl
    • Hidden
    • IsShared
    • ProviderConnectionPoints
    • Title
    • TitleStyle
    • TitleUrl
    • Verbs
    • Zone
    • ZoneID
    • ZoneIndex

    Most of these are self-evident as to their purpose. I’ll quickly explain those that perhaps aren’t as obvious:

    • AllowZoneChange: controls whether or not users can drag the Web part onto another zone.

    • ChromeState: sets the display state of the web part as normal or minimized.

    • ChromeType: modifies how the Web part is framed. The default is title and border, but you can set it to border, title, or none.

    • IsShared: determines whether multiple users are to share the Web Part.

    • ProviderConnectionPoints: used for communicating, or sharing data, between multiple Web parts on one page.

    • Verbs: allows you to modify the wording where "minimize/close/restore" appears.

    Rather than setting these properties programmatically on an individual basis for each Web Part object, it is simpler to set properties in the zone, to apply to all Web Parts that are contained within. I’ll take the previous example, and add some formatting to it:

    <%@ register tagprefix=”jc” tagname=”Weather” src=”weather.ascx” %>
    <%@ register tagprefix=”jc” tagname=”Stocks” src=”stocks.ascx” %>
    <%@ page language=”C#” %>

    <html>
    <head>
    <title>webparts tutorial</title>
    </head>
    <body>
     <form runat=”server” id=”Form1”>
      <asp:WebPartManager runat=”server” id=”myWebMgr” />
      <asp:WebPartZone runat=”server” id=”zone1” PartChromeType=”Title”>
      <CloseVerb text=”hide” />
      <minimizeverb text=”shrink” />
      <PartStyle BackColor=”#CCC” />
      <ZoneTemplate>
            <jc:Weather runat=”server” id=”myWeather” />
            <jc:Stocks  runat=”server” id=”myWeather” />
           </ZoneTemplate>
      </ asp:WebPartZone>
     </form>
    </body>
    </html>

    I changed a couple of the display settings here. To make the interface all the more user friendly, you could change the "verbs" (minimize/close) to images reminiscent of the same functionality in your favorite operating system. Here’s an example:

    <CloseVerb imageurl=”~/images/x.png” text=”hide”
     Description=”close this section”/>

    If you do this, the text property now becomes the alternate text for x.png, the image button used in its place.

    More ASP.NET Articles
    More By Justin Cook


       · hey,Justin Cook here. Hope you enjoy the article!
       · Hi justin,I'm just a little confused with the development of web parts....
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT