Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Web Part Visible based on View Mode View modes: 
User avatar
Member
Member
Swainy - 8/29/2013 5:29:53 AM
   
Web Part Visible based on View Mode
Hi,

Is there a way to set a web part to only be visible for a certain view mode? I want to display the web part (editable text region), so that an admin person can add content into it, but I am using the API to put this text elsewhere on the site (it just acts as a placeholder for the admin user).

I want it to display inside CMSDesk but the content not display on the site.

I have tried using the following macro in the Visible condition but it doesn't seem to work. Any ideas?

{%CMSContext.ViewMode == ViewModeEnum.Edit%}

Thanks,

Matt

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/29/2013 7:37:42 AM
   
RE:Web Part Visible based on View Mode
I thought that might have worked as well. What I've done is created a boolean field (IsVisibleOnLiveSite) and then perform checking in your webpart code behind as you describe because I know that works.

If you come up with a different solution, please post!

Brenden

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/29/2013 8:27:20 AM
   
RE:Web Part Visible based on View Mode
Hi,

I do not see any issues using that macro. Have you tried using the macro debug to see how is this macro resolved?

Best regards,
Juraj Ondrus

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/29/2013 9:49:01 AM
   
RE:Web Part Visible based on View Mode
Or, using the old macro like this:
{%ViewMode|(notequals)LiveSite%}


Best regards,
Juraj Ondrus