Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Web part visibility based on it's own content View modes: 
User avatar
Certified Developer 13
Certified Developer 13
matt-pixelbuilders - 10/11/2013 8:10:04 AM
   
Web part visibility based on it's own content
Hi guys,

I'm looking to add a macro to a web part which will set it's visibility based on whether there is any content entered into the editable text area (web part I'm using).

Is it possible to get the current context of the web part and if so does anyone have any code hints?

Thanks

User avatar
Member
Member
vcarter - 10/11/2013 12:47:34 PM
   
RE:Web part visibility based on it's own content
Are you referring to two web parts? Or the visibility of the editable text area webpart?

If it is the same webpart, just put all of your formatting into the transformation and use the IfEmpty method to control display.

If you are trying to control one webPart with another, I think you would need to use some scripting to check for the existence of content and show/hide your other content based on that. However, I am no expert, so don't quote me on that ;)

User avatar
Member
Member
kentico_sandroj - 10/11/2013 8:58:09 PM
   
RE:Web part visibility based on it's own content
Hello,

The IfEmpty suggestion should work but the PageInfo object has EditableWebParts property which is Hashtable, so you can check the content using PageInfo.EditableWebParts[idofwebpart].

Please let me know if you have any questions.

Best Regards,
Sandro

User avatar
Certified Developer 13
Certified Developer 13
matt-pixelbuilders - 10/14/2013 5:05:19 AM
   
RE:Web part visibility based on it's own content
Great thanks guys, yes it's just for the one web part.