ASPX templates
Version 7.x > ASPX templates > CMSEditableRegion in WebPart - duplicate values View modes: 
User avatar
Member
Member
btagis - 9/25/2013 9:55:25 AM
   
CMSEditableRegion in WebPart - duplicate values
Hello,

Another quick question. I'm having issues with content being duplicated across CMSEditableRegion controls, when they are within custom CMSWebParts.

The scenario is, a user needs to add many of these custom CMSWebParts to the same portal placeholder; each WebPart is of the same type, each containing 2 CMSEditableRegions. These contain a header, and HTML Editor content. Simple.

Unfortunately in practice, the content of all CMSEditableRegions with the same ID (in codebehind) is the same.

Searching these forums, appears to be a potential workaround by manually manipulating the ID of each CMSEditableRegion prior to the control loading. Is this really necessary, or is there another control or technique I can use to avoid such a hack?

Thanks.

User avatar
Member
Member
kentico_sandroj - 10/1/2013 3:07:48 PM
   
RE:CMSEditableRegion in WebPart - duplicate values
Hello,

You do not have to manually set the IDs for each control but they do have to be unique. You could use a macro to generate the unique IDs, would that work for you?

Best Regards,
Sandro

User avatar
Member
Member
btagis - 12/6/2013 6:13:21 AM
   
RE:CMSEditableRegion in WebPart - duplicate values
Hi Sandro,

thanks for your reply, and sorry for the delay (should subscribe to post)... we've worked around the issue with the really simple technique documented elsewhere in the forum, for reference:


public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
}

/// <summary>
/// Initializes the control properties
/// </summary>
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do not process
}
else
{
whatever.ID = whatever.ID + base.ID;
}
}