Tag Archives: WebPartZone

[RESOLVED] WebParts – how to open WebPartZone



I am not very familiar with web parts.

When I click link “Close” on WebPartZone all this control disappear. How can open again WebPartZone that has been closed before?



I'm assuming you were refering to the WebPart that is being closed from the WebPartZone. If so then basically all closed WebParts are stored in the WebParts PageCatalogPart.. If you wanted to open/add the Webparts that you have closed in the WebZone then you need to use the PageCatalog control.

But can I have just button with click event handler and code in this handler that will open previously closed webpartzone?

You can loop through the WebPartManager WebParts collection and then determine the previous closed WebParts and then use the AddWebPart method of WebPartManager to add WebParts to the WebPartZone:


[RESOLVED] How to keep only one web part control in a zone !

Hi All,

I have a page that has 5 zones, by default have also defined the layout.

Now I need to restrict the user to have only one web part control in a zone at a time. Is that possible? Currenty we can add more than one control in the same  zone.





I am not sure but I assume that you need to set the AllowLayOutChange property to false



Hi KumaranM,

Based on my experience, the answer is no.

I think the webpart zone include the Template, and the template generally can include many controls in it.

    <asp:WebPartZone ID="WpZone1" runat="server">
          <asp:Label ID="Label1" runat="server" Text="Label" />
                <asp:Button ID="Button1" runat="server" Text="Button" />

Please check the following link:


[RESOLVED] Web Part - single click edit

I am trying to implement a one click edit capability in a web part.  I want the edit verb to always be visiable and enter edit mode when the user clicks. 

I have not found a way to make the edit verb visible in browse mode.


I have created a custom verb called edit that will display in browse mode.  When this is clicked I put the page in edit mode, but I cannot figure out how to 'select' the web part. 

I know which part was clicked, it is the one whose event handler fires, but I do not know how to make it the selected webPart.  The selectedWebPart property of the WebPartManager is ready only.


Any ideas?




I solved the issue by putting the page in Edit mode all the time.  I hid the webPartZone header and it looks like broswe mode.

WebPart drag and drop

I cannot get the Drag and Drop functionality of Web Parts is to work.  I have a very simple test page with two WebPartZones.  .  In the OnInit method of the code behind I put the page in design mode.  In the first zone I have a textbox.
At runtime the text box renders as a web part.    When I hover over the web part header my mouse pointer changes the ‘move’ pointer, but I cannot drag the item.  I do not see it dragging and the part never moved.

I am using Visual Studio 2010 with IE 8.  I have tried IE8 in compatibility mode and regular mode.  The results are the same.

Here is the markup from my test page:
<form id="form1" runat="server">
    <asp:WebPartManager ID="WebPartManager1" runat="server">

    <asp:WebPartZone ID="LEFT" runat="server">
            <asp:TextBox ID="tb" runat="server" />
    <asp:WebPartZone ID="RIGHT" runat="server">
    <asp:EditorZone ID="EditorZone1" runat="server">

Here is the code behind:
protected override void OnInit(EventArgs e)
    WebPartManager mgr = WebPartManager.GetCurrentWebPartManager(this);
    mgr.DisplayMode = WebPartManager.DesignDisplayMode;

What am I missing?


I'm not sure but try to set the display mode at Page_Load event instead.


You've posted the same thread in forum. Check this:


[RESOLVED] WebPart Drop Event


I'm using webPart in my App and need to get a handler when a user changed(drag and drop) a zone?


I found that all webpartzones are mastered by WebPartManager! it's done fast but it can help other member.

WebPartManager1.WebPartMoved will help now Laughing