A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Anything similar to EditContainerClass using ASP.NET Forms?

Vote:
 

Is there any way to set styles on the editor control similar to what EditContainerClass does under MVC in a ASp.NET Forms based EPiServer 7 site?

#76473
Oct 25, 2013 11:42
Vote:
 

Not sure exacty what you are after but you could use the webcontrol <episerver:property><rendersetting../></episerver:property> you could also set an id to a control like <asp:label> or <asp:image> and set the ApplyEditAttributes from code behind.

#76481
Oct 25, 2013 14:17
Vote:
 

Didn't know about the RenderSetting, seem to be exactly what I'm looking for.

Thanks Eric! :)

#76708
Edited, Oct 31, 2013 13:08
Vote:
 

I had the same question.  I do not see EditContainerClass as a property of the RenderSetting web control.  Am I missing something?

#77246
Nov 13, 2013 16:22
Vote:
 

Did you find a solution for this? I cant get the rendersettings-tip to work.

#83083
Mar 25, 2014 15:11
Vote:
 

No, we have unfortunately not been able to get this to work :(

#83084
Mar 25, 2014 15:37
Vote:
 

Does not seem to be any EditContainerClass in the webcontrol but that should most of the times be renderd by the control it self. If you have a asp.net webcontrol you can set that from code behind

heading.ApplyEditAttributes<ImageGalleryBlockType>(p => p.Heading);

    

#83087
Mar 25, 2014 15:48
Vote:
 

I fixed it by declaring a property such as this:

<EPiServer:Property runat="server" PropertyName="MainBody">
   <RenderSettings EditContainerClass="overflow-hidden" />
</EPiServer:Property>

And then using jquery to set the class for the property in edit mode, such as this:

<script type="text/javascript">
  $("[data-epi-property-rendersettings]").each(function () {
    $(this).addClass($(this).data('epi-property-rendersettings').editContainerClass);
  });
</script>

    

The javascript simply loops through all elements in the DOM that has the data-epi-property-rendersettings attribute and sets the class accordingly. Too bad this is not supported by EPiServer though. Using reflector on the source code it looks like EditContainerClass is only for MVC.

#83111
Edited, Mar 26, 2014 8:51
Vote:
 
<EPiServer:Property runat="server" PropertyName="MyContentArea" >
            <RenderSettings ChildrenCssClass="overflow-hidden" />
        </EPiServer:Property>

    

This seems to work

#85018
Edited, Apr 11, 2014 9:46
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.