Objective
To develop a web application using WebParts in asp.net
- Design: Design the form with one WebPartManager, one DropDownList, two or more WebPartZone controls, one CatalogZone control, one EditorZone control.
- Create a few web user controls and place one in WebPartZone1, another in WebPartZone2
- Now place DeclarativeCatalogPart control in CatalogZone1
- select DeclarativeCatalogPart1->click on '>' button, select 'Edit Templates'and place all the created webusercontrols in it-> select 'End TemplateEditng'.
- Place LayoutEditorPart, AppearanceEditorPart, PropertyGridEditorPart, BehaviourEditorPart in EditorZone1
- Select DropDownList1-> Edit Items-> Add Browse,Design,Catalog,Design and also check EnableAutoPostBack option
Code
using System;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class _Default : System.Web.UI.Page
{
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DropDownList1.SelectedIndex)
{
case 0:
WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
break;
case 1:
WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
break;
case 2:
WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
break;
case 3:
WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
break;
default:
break;
}
}
}

knightsPosted Jan 10, 2011, 9:39 PM
I appreciate you took it positively and i hope you will continue to bring interesting topics in future as well.
knightseditedPosted Jan 10, 2011, 10:35 AMEdited Jan 10, 2011, 5:08 PM
Dear Prashanth, When you write an article and you copy some data from another article, you need to reference it and should give the due credits to the author. In this case the article is explained at http://www.beansoftware.com/ASP.NET-Tutorials/Web-Parts.aspx. This is unfair to publish someone's work in your name and not giving any reference at all about the author/website who's work being mentioned. Thanks.