Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Custom Web Part Holds UserControl Problem View modes: 
User avatar
Member
Member
eli.sack-diamonds - 11/12/2009 12:55:17 AM
   
Custom Web Part Holds UserControl Problem
Hi,
I have a Custom web pat that I developed it holds a number of user controls that I developed too. The inner user controls has a "cmseditableregion". The problem is that for some reason when I place data in to the "cmseditableregion" using the CMS Desk after saving all of the "cmseditableregion" get the same data. I am assuming that your system works on the inner ID (written in the code) of the "cmseditableregion" which is the same for all and not on the client ID which is unique

Is there any solution to my problem?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 11/12/2009 6:12:51 AM
   
RE:Custom Web Part Holds UserControl Problem
Hello,

Yes, there is ID of editable regions used when storing content in DB. You could solve this issue by adding code which will generate unique ID for these editable regions. You can set ID of editable region e.g. as concatenation of editable control ID and custom webpart ID (you can ensure this e.g. in OnContentLoaded event). This procedure should ensure that every editable control in each webpart has unique ID and then the desired functionality should work correctly.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
eli.sack-diamonds - 11/12/2009 1:12:02 PM
   
RE:Custom Web Part Holds UserControl Problem
Hi I tried paying around with the ids but with no success. I am not sure what to do with the OnContentLoaded and what ID should I try and change he is a snip of my code if you can help me with an example that would be great

Parent user control (web part):

<%@ Register Src="../UserControls/MenuItem.ascx" TagName="MenuItem" TagPrefix="uc1" %>
...

<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<uc1:MenuItem ID="MenuItem1" runat="server" /> <uc1:MenuItem ID="MenuItem2" runat="server" />
</td>


Inner user control ues 2 times in the parent



MenuItem.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuItem.ascx.cs" Inherits="Dnet_UserControls_MenuItem" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cc1" %>
<cc1:cmseditableregion id="erTopMenu" runat="server" dialogheight="40" dialogwidth="100" regiontype="HtmlEditor" regiontitle="Content" />

MenuItem.ascx.cs:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CMS.PortalControls;

public partial class Dnet_UserControls_MenuItem : CMSAbstractWebPart
{
public override void OnContentLoaded()
{
}
protected void Page_Load(object sender, EventArgs e)
{
}
}

User avatar
Member
Member
eli.sack-diamonds - 11/12/2009 1:14:06 PM
   
RE:Custom Web Part Holds UserControl Problem
also... would you know if I can add a web part zone into a custom web part? how would do it?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 11/24/2009 2:46:26 AM
   
RE:Custom Web Part Holds UserControl Problem
Hello,

Regrettably, web part zones are not natively supported within web parts - they are intended to be used in layout of Portal Engine template. Could you please optionally let us know why you need web part zone in web part, so we can advice you some workaround if possible?

Best Regards,

Martin Dobsicek