Category Archives: EditorZone

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">
<div>
   
    <asp:WebPartManager ID="WebPartManager1" runat="server">
    </asp:WebPartManager>

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


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


What am I missing?

Thanks,
   Don

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

Hi,

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

http://forums.asp.net/t/1654654.aspx

propertyGridEditorPart

 

I am using web parts and when i used propertyGridEditorPart in run time it does not appear although i am putting it in EditorZone and the page is in EditDisplayMode and i choose the Control which I want to Edit, Can Anybody Help me Please. I searched about this and I found that I should make the page in Share mode not in User mode but I did not work with me

 

See below discussions:

http://forums.asp.net/p/668618/668618.aspx#668618

http://forums.asp.net/p/1294354/2510301.aspx#2510301

hi

I used this but it only worked with BehaviorEditorPart and it didn't work with PropertyGridEdiorPart. I Do need to use PropertyGridEditorPart but it didn't appear in the page in the RunTime. Can you please help me and tell me what to do exactly

Better if you will refer to the following article below about PropertyGridEditorPart Class

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.propertygrideditorpart.aspx

I made everything but all in vain. I still have my problem. The PropertyGridEditorPart DOES NOT appear when I run the page. This is driving me crazy. Can anybody help me???????????

Actually I Find the EditorZone containing the following message

Modify the properties of the Web Part, then click OK or Apply to apply your changes.

 With no Textboxes or labels

Hi

I had the same problem. i think u need to create a custom webpart control which inherits from Webpart class and then u need to define atleast one property as [Personalizable] so that property will appear in your propertyGridEditorPart at runtime.. u can try this link for creating custom webpart control.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/webparts/custom.aspx

 

hope this works for u.. :)

hi u need to make that property [WebBrowsable] so that it will appear in propertyGridEditorPart.

If you post some code.It will be easy to find the problem.

[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.

Hi,

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.

sajidali3387

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">
  <ZoneTemplate>
    <asp:AppearanceEditorPart CssClass="EditorPart" ID="epart1" runat="server" />
  </ZoneTemplate>
  <PartTitleStyle CssClass="EditorPartTitle" />
</asp:EditorZone>
<style type="text/css">
        .EditorPart
        {
            width:300px;
            height:300px;
        }
    </style>

Please check the link below for more information:

http://www.codeproject.com/KB/aspnet/WebParts.aspx

http://weblogs.asp.net/drnetjes/archive/2005/06/23/414355.aspx

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 other.eg 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" />
    </asp:WebPartManager>
  
    <div style="width: 700px">
   
      <asp:WebPartZone ID="WebPartZoneTop" runat="server"
        HeaderText="Top Zone" style="width: 700px; height: auto">
        <ZoneTemplate>
         
            <uc1:MyCalendar ID="Calendar1" runat="server"/>
         
        </ZoneTemplate>
      </asp:WebPartZone>
     
      <div style="width: 395px; float: right; height: auto; padding-left: 5px">       
        <asp:DropDownList ID="ddl_ListMode" runat="server" AutoPostBack="true"
          OnSelectedIndexChanged="ddl_ListMode_SelectedIndexChanged">
        </asp:DropDownList>       
        <asp:EditorZone ID="editor1" runat="server">
            <ZoneTemplate>
                <asp:AppearanceEditorPart Runat="server" ID="AppearanceEditorPart1" />
            </ZoneTemplate>
        </asp:EditorZone> 
     
      </div>
     
      <asp:WebPartZone ID="WebPartZoneBottom" runat="server"
        HeaderText="Bottom Zone" style="width: 700px; height: auto;">
        <ZoneTemplate>
        </ZoneTemplate>
      </asp:WebPartZone>
   
    </div>
    </form>

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;
        ddl_ListMode.Items.Clear();

        foreach (WebPartDisplayMode objWebPartDisplayMode in objWebPartManager.SupportedDisplayModes)
        {

            //Only BrowseDisplayMode is enabled, I don't know why
            if(objWebPartDisplayMode.IsEnabled(objWebPartManager))
                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.

 

Cheers,

Agus

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.