Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Move webpart to a zone programmatically? View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
emar - 6/29/2011 9:01:45 AM
   
Move webpart to a zone programmatically?
Based on the content of a page, I would like to display a webpart either on the center or right column. Can this be done via the api or jvs call?

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 7/1/2011 9:07:40 AM
   
RE:Move webpart to a zone programmatically?
Hi,

I'm not sure how exactly do you want your solution to act.
There are more possibilities:

Simple approach is that you could add the web part into both zones (e.g. add it twice to the page template, each one in different zone) and using a macro expression (or custom macro) in the web part's "Visible" property, you could set whether it will be displayed or not (according to the returned value - true or false).

Another approach would be to move whole webpart rendered HTML code using javascript, however this is useful rather for simple webparts without any buttons, form controls or so, because they use identifiers dependent on the controls structure.

As for the API approach, it would be also possible, however it won't be probably feasible to do this in real time - for dynamic page rendering ... Maybe if you could describe your aim in more details, we can advise better...

Regards,
Zdenek