Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

CssClass Property not Rendered on a RichHtmlField Control

  Asked By: Kris Mccray         Date: Apr 23, 2010      Category: Sharepoint      Views: 629
 

Am I doing something wrong here? I specify a class for the CssClass property on the RichHtmlField control, but all that's rendered is style="display:inline", which is actually very undesirable in my case. This normally wouldn't be a big deal, as you'd think I could override that div by applying a style to all the div's in a parent container, but that has a horrible affect in edit mode where there an many other DIV tags present and messes with the editing controls.

Here's what my control in the page layout looks like:


<PublishingWebControls:RichHtmlField ID="RichHtmlField2" FieldName="MainContent1" runat="server" CssClass="htmlField"/>

and here's what's rendered:

<div id="ctl00_PlaceHolderMain_RichHtmlField2__ControlWrapper_RichHtmlField" style="display:inline"></div>

Where's my "htmlField" class? You can't specifiy a class property directly either as that throws an error. And I don't want to wrap div tags around each control as those will still be rendered when not conten is put in the control. Any other ideas/workarounds?

Tagged:              

 

1 Answer Found

 
Answer #1       Answered By: Hema Pasupuleti          Answered On: Apr 23, 2010       

Adding class="test" doesn't work so hot, throws  an error. Also, as you have pointed out, you could place a <div class="test"></div> around the field control  and then style  the div  inside of it. You could also correct your edit  mode problem by cancelling out that style with some CSS that only appears in edit mode  with <PublishingWebControls:EditModePanel>.

 
Didn't find what you were looking for? Find more on CssClass Property not Rendered on a RichHtmlField Control Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].