Same problem...
I don't have any solutions right now but still looking ahead.
Well... Only one working solution may be used here - you must place <EPiServer:Property> and surrounding text inside a <table>...</table>. Property - inside it's own <td>...</td>. Only then you won't take the full weight of this bothering <div>...</div> tags.
I hope EPiServer's devlopping team will guive us something to correct this issue in the future...
This is quite an uneducated guess, but:
The property you are using is an Xhtml-string (>255), that is located in EPiServer.SpecializedProperties.PropertyXhtmlString which in turn inherits from EPiServer.Core.PropertyLongString. If we take a look at PropertyLongString we see that the control used to render a PropertyLongString is a EPiServer.Web.PropertyControls.PropertyLongStringControl.
Again, if we look at PropertyLongStringControl we see that it's CreateDefaultControls method (which is used to create the default representation of the control) is something like:
Panel target = new Panel(); Literal child = new Literal(); child.Text = this.toWebString(); target.Controls.Add(child); this.Controls.Add(target);
So, it renders a Panel with a Literal inside of it, a Literal does not render any specific markup by itself, but the Panel will render a <div> tag.
So, an option to get around this would be to read the articles by Steve and Mari which describe how to change this behaviour:
Article by Steve: Taking Control of Property Rendering
Article by Mari (followup): Replacing Property Rendering Using Adapters
Hope this is helpfull, and as a disclaimer, I have not tested this myself, I am only guessing.
Hi,
Has anyone manage to override PropertyLongStringControl so the extra <div> tag will be removed? I tried to follow the articles from Steve and Mari but it doesn't seem to work.
I managed to get PropertyStringControl to work but not PropertyLongStringControl. Any have some working code to share?
Best Regards
Anders
As Aanund wrote in his post, this can be solved by reading through the blog postings by Steve and me. I did a quick test, and got it up and running. I created a PageAdapter (code sample below) and mapped the new adapter using the .browser file. Note that you should add check to see if property has value, and if any css class is provided.
using EPiServer.Web.PropertyControls.Adapters; namespace EPiServer.Templates { public class LongStringAdapter : PropertyDataControlAdapter { public override void CreateDefaultControls() { //base.CreateDefaultControls(); //Panel target = new Panel(); Literal child = new Literal(); child.Text = this.ToWebString(); //target.Controls.Add(child); //this.Controls.Add(target); this.Control.Controls.Add(child); } } }
In .browser:
<adapter controlType="EPiServer.Web.PropertyControls.PropertyLongStringControl" adapterType="EPiServer.Templates.LongStringAdapter" />
/Mari
Hi,
I have demo installation of EPiServer (demo site) in version 5.1.422.122. In markup file I have this code:
<div id="MainBodyArea">
<EPiServer:Property PropertyName="MainBody" EnableViewState="false" runat="server" />
</div>
MainBody property has this value (html):
<H1>Welcome</H1>
<P>EPiServer is an easy and adaptable platform for communication and collaboration on the web, fully integrated in the organizations activities and business processes. With EPiServer CMS 5 we have laid the foundation to realize bigger, funnier, more powerful and intense web sites.</P>
But this is rendered as:
<div id="MainBodyArea">
<div>
<h1>Welcome</h1>
<p>EPiServer is an easy and adaptable platform for communication and collaboration on the web, fully integrated in the organizations activities and business processes. With EPiServer CMS 5 we have laid the foundation to realize bigger, funnier, more powerful and intense web sites.</p>
</div>
</div>
Please note additional div elements inside div with id MainBodyArea. In admin mode option Use DIV in Editor instead of P is NOT selected.
Is there any way to stop episerver:property to render this additional div tag?
--
Best regards,
Dominik