0

I have this page layout where I'm exposing and making editable the 'CustomSiteCategory' property on edit mode

<PublishingWebControls:editmodepanel runat="server" id="editmodepanel1">
    <SharePointWebControls:DropDownChoiceField
          ID="DropDownChoiceField1"
          FieldName="CustomSiteCategory"
          runat="server">
    </SharePointWebControls:DropDownChoiceField>
</PublishingWebControls:editmodepanel>

This works fine and I'm able to modify the property when I edit the page.

Now a new requirement came up to show an icon on the page based on what the 'CustomSiteCategory' is.

I thought this would be trivial, but since 'CustomSiteProperty' is in the EditModePanel, the HTML for it doesn't get rendered when in non-edit mode so I can't use JavaScript sorcery to pull this property.

Ideally, what I would like is for this property to be shown/editable only in edit mode, and outside of it, it should still render in the HTML as something like

<div style="display:none" id="CustomSiteProperty">[CustomSiteProperty value]</div>

Is there any way to do this? I'm also open to alternatives.

1 Answer 1

1

Found the solution for this. All I needed to use was <SharePointWebControls:FieldValue>.

Using this, I'm able to do something like this:

<span style="display:none" id="custom-site-property">
  <SharePointWebControls:FieldValue
    id="FieldValue1"
    FieldName="CustomSiteProperty"
    runat="server"/>
</span>

Here's the relevant article that led me to the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.