Category Archives: AppearanceEditorPart

[RESOLVED] How to maintain aspect ration of Height and Width of Web-Part in AppearanceEditorPart.

Is there any way or workaround so that we can maintain aspect ration of Height and Width of Web-Part in AppearanceEditorPart.


When the editing UI is visible, you can see the AppearanceEditorPart control. If you make some changes in the editing UI and click the Apply button, you can use the Display Mode drop-down list to return the page to browse mode and see the full effect of the editing changes.


so that we can maintain aspect ration of Height and Width of Web-Part in AppearanceEditorPart.

You can use CSS to define the layout like this:

<asp:EditorZone runat="server" ID="EditorZone1">
    <asp:AppearanceEditorPart CssClass="EditorPart" ID="epart1" runat="server" />
  <PartTitleStyle CssClass="EditorPartTitle" />
<style type="text/css">

Please check the link below for more information:

Hope this helps.

Thank's for your reply.

I want to set the height and width aspect ration of the Web-Part not the AppearanceEditorPart.So more precisely can we make a AppearanceEditorPart that containts Height and Width TextBoxes where values can be entered in relation with each 9:8 if i increase the height the width should also increase.

Is there any way for doing this.

Thanks's in advance.

[RESOLVED] EditDisplayMode don't appear in combo

Hello mates,


I'm trying to show all the web part display mode in a combo.

I've added the editorzone,webpartmanager and my webparts.

The problem is that in the combo only appears the BrowseDisplayMode.

 Here is the html code:

<form id="form1" runat="server">
    <asp:WebPartManager ID="WebPartManager1" runat="server">
        <Personalization Enabled="true" />
    <div style="width: 700px">
      <asp:WebPartZone ID="WebPartZoneTop" runat="server"
        HeaderText="Top Zone" style="width: 700px; height: auto">
            <uc1:MyCalendar ID="Calendar1" runat="server"/>
      <div style="width: 395px; float: right; height: auto; padding-left: 5px">       
        <asp:DropDownList ID="ddl_ListMode" runat="server" AutoPostBack="true"
        <asp:EditorZone ID="editor1" runat="server">
                <asp:AppearanceEditorPart Runat="server" ID="AppearanceEditorPart1" />
      <asp:WebPartZone ID="WebPartZoneBottom" runat="server"
        HeaderText="Bottom Zone" style="width: 700px; height: auto;">

And here is part of the code behind:

protected void Page_Init(object sender,EventArgs e)
        Page.InitComplete += new EventHandler(GenerateModeList);

    protected void GenerateModeList(object sender,EventArgs e)
        WebPartManager objWebPartManager = WebPartManager.GetCurrentWebPartManager(Page);
        string sBrowseMode = WebPartManager.BrowseDisplayMode.Name;

        foreach (WebPartDisplayMode objWebPartDisplayMode in objWebPartManager.SupportedDisplayModes)

            //Only BrowseDisplayMode is enabled, I don't know why
                ddl_ListMode.Items.Add(new ListItem(objWebPartDisplayMode.Name, objWebPartDisplayMode.Name));
        ListItemCollection objListItemCollection = ddl_ListMode.Items;

        ddl_ListMode.SelectedValue = ddl_ListMode.Items.FindByText(objWebPartManager.DisplayMode.Name).Value;

Just rememberring, the aspnetdb is hosted in sql server 2008.

Any help would be great.




Hi agusayala,

I have tested the code you provided locally.However,EditDisplayMode can appear in combo according to your code. The issue can't be reproduced.

In order to resolve your issue, please do it as follows:

1.Please check the configuration in the Web.config.

2. Make use of IE Develop Tools to debug the project.

 If I have anything misunderstood, please let me know.Thank you for your help.



I am trying to create an iGoogle like page in .net 3.5

I have written code(in to dynamically add usercontrols to 2 webzones.....pretty simple stuff....

what i want to know right now is how do i MAXIMIZE each webzone seperately as in if i click o a button on the title bar it should occupy the whole page and then on mininmizing it should come back to its original state.(kinda like what happens in iGoogle)

Also, if you run the code i am pasting, you will see that on button_click it CREATES a new webzone everytime....and i still cannot figur out how to change the title of the controls form 'UNTITLED'..

I'l go ahead and say i am a novice and a full explanation along with implementable code would be REALLY GREAT :):):)...and i Do Not want to use pre packaged stustuff like dynamic dashboard plugin n the likes....:)


The folllowing is my .cs code 

public partial class Process_Flow_Dashboard_Default : System.Web.UI.Page


    protected void Page_Load(object sender, EventArgs e)
        //done nothing here as I am trying to get the funcionalities of the web part before implementing in the proper page.
       //probably wrong so please correct me


    //The basic idea is that once the page is complete, there will be a multiple check box list with a list of widgets.
    //the ones which are checked will be added to the page in the zones.a very basic DASHBOARD so to say.

    protected void btn1_Click(object sender, EventArgs e)

        //Getting the usercontrol through my local path(placed it in the same folder, so file name was sufficient)
        UserControl Test = (UserControl)LoadControl("Subtract.ascx");

        Test.ID = "test";

        GenericWebPart part1 = WebPartManager1.CreateWebPart(Test);//creating first webpart
        UserControl Add = (UserControl)LoadControl("Test.ascx");//Adding second webcontrol

        Add.ID = "Add";

        GenericWebPart part2 = WebPartManager1.CreateWebPart(Add);

        WebPartManager1.AddWebPart(part1, Zone1, 0);//adding to first webzone.


        WebPartManager1.AddWebPart(part2, Zone2, 1);//adding to second webzone.
        WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;//so that i can move the webparts around from one zone to another.

        part1.Title.Equals("Zone1");//trying to change the title of the webparts, not working:(

And here is my html part: 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Process_Flow_Dashboard_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    <table id="webTable1" runat="server" width="100%">
                <asp:WebPartManager ID="WebPartManager1" runat="server" Personalization-Enabled="true">
                <asp:EditorZone ID="EditorZone1" runat="server">
                        <asp:AppearanceEditorPart ID="AppearanceEditorPart1" runat="server" />
                <asp:Button ID="btn1" runat="server" Text="Button" OnClick="btn1_Click" />
                <asp:WebPartZone ID="Zone1" runat="server" Width="100%" DisplayTitle="Zone 1">
                <asp:WebPartZone ID="Zone2" runat="server" Width="100%" Title="Zone 2">


You can Customize switching of DisplayModes, interactions of WebPart verbs (minimize, Maximize etc..)..

Please check the following link:

You can change the WebZone.HeaderText Property to change the title.

I written a small article about adding title button and maximizing Web parts with JQuery

[RESOLVED] Changing web part title and AppearanceEditorPart


   I want to allow users to change web part title and it works fine using the AppearanceEditorPart. Problem is AppearanceEditorPart has other UI elements like changing size(which doesn't seem to work somehow) and I want to disable that. Is that possible at all? Alttrantively, I want to add a custom zone verb that allows changing the title of a web part. I can add the verb but how to show the UI that allows the new title text to be entered? Do I need to use regular ASPX page for that?

Thanks in advance and regards




This is a complete overview of webparts:

<%@ Page Language="VB"%> < %@ Register Src="DailyLinks.ascx" TagName="DailyLinks" TagPrefix="uc1" %>
< script runat="server"> Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim wpDisplayMode As WebParts.WebPartDisplayMode = _ Webpartmanager1.SupportedDisplayModes(DropDownList1.SelectedValue.ToString()) Webpartmanager1.DisplayMode = wpDisplayMode
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) For Each wpMode As WebPartDisplayMode In _
Next End Sub
Dim modeName As String = wpMode.Name Dim dd_ListItem As ListItem = New ListItem(modeName, modeName) DropDownList1.Items.Add(dd_ListItem)
< html xmlns=""> < head id="Head1" runat="server">
< title>Web Parts Example</title> < /head> < body>
< form id="form1" runat="server"> < asp:WebPartManager ID="Webpartmanager1" Runat="server"> < /asp:WebPartManager> < table cellpadding="5" border="1">
< tr> < td colspan="2">
< h1>Bill Evjenā€™s Web Page</h1> < asp:WebPartZone ID="WebPartZone1" Runat="server" LayoutOrientation="Horizontal" >
< ZoneTemplate>
<asp:Label ID="Label1" Runat="server" Text="Label" Title="Welcome to my web page!" > Welcome to the page! </asp:Label>
< /ZoneTemplate> < /asp:WebPartZone>
< /td> < td valign="top">
Select mode: <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" > < /asp:DropDownList>
< /td> < /tr> < tr valign="top">
< td> < asp:WebPartZone ID="WebPartZone2" Runat="server">
< ZoneTemplate> < asp:Image ID="Image1" Runat="server" ImageUrl="~/Images/Tuija.jpg" Width="150px" Title="Tuija at the Museum" > < /asp:Image> < uc1:DailyLinks ID="DailyLinks1" runat="server"
< /tr> < /table>
< /form> < /body> < /html>
Title="Daily Links" > < /uc1:DailyLinks>
< /ZoneTemplate> < /asp:WebPartZone>
< /td> < td>
< asp:WebPartZone ID="WebPartZone3" Runat="server"> < ZoneTemplate>
< asp:Calendar ID="Calendar1" Runat="server" Title="Calendar" > < /asp:Calendar>
< /ZoneTemplate> < /asp:WebPartZone>
< /td> < td><!-- Blank for now --> < /td>
< /tr> < /table>
< /form> < /body> < /html>

Thanks. I was rather asking for how to change only title of the web part without using AppearanceEditorPart if possible.

Try to use WebPartManagerX.WebParts(z).Title="XY"

[RESOLVED] Editing properties in a PropertyGridEditorPart

I have several properties listed in PropertyGridEditorPart of the EditorZone.

I want to hide some of the properties at run time depending on which WebPart is being edited.

How can access the individual properties so that I can hide them?

Your help would be much appreciated.

Thanking you in anticipation.


Hi Rogerwithnell,

The PropertyGridEditorPart provides a generic user interface (UI) that enables users to edit custom properties on WebPart and server controls placed in WebPartZoneBase zones. In contrast, the other EditorPart controls, such as the AppearanceEditorPart and BehaviorEditorPart controls, edit only existing, UI-oriented properties from the WebPart class.

Because the PropertyGridEditorPart control allows you to edit only custom properties, you will need the other EditorPart controls in the Web Parts control set to edit the appearance, layout, and behavior of WebPart controls. The other controls include the BehaviorEditorPart, the LayoutEditorPart, and the AppearanceEditorPart controls. These EditorPart controls should provide most editing features required to edit WebPart controls, but if necessary, you can also create a custom editor control by inheriting from the EditorPart class.


The PropertyGridEditorPart control provides an editing UI for properties that are marked in the source code with the WebBrowsable attribute (from the WebBrowsableAttribute class). When a property is marked with this attribute, a PropertyGridEditorPart control creates the editing UI based on the type of the property, and uses a PropertyDescriptor object if needed to convert the value in each editing control to the type of the property. You can also add other attributes that help the PropertyGridEditorPart control to display the editing UI. The WebDisplayName attribute (from the WebDisplayNameAttribute class) allows you to specify the text for the label that appears with each control in the editing UI. The WebDescription attribute (from the WebDescriptionAttribute class) allows you to specify a string that appears as a ToolTip for each control in the editing UI.

The controls created to edit properties of various types are listed in the following table.

<div class="caption" xmlns=""></div> <div class="tableSection" xmlns="">

Property type

Control created to edit the property



Int, Float, Unit





DropDownList (contains the list of enumerated values)




Please refer to :