Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Share data between webparts View modes: 
User avatar
Member
Member
caramoSC - 7/22/2011 10:50:22 AM
   
Share data between webparts
I have 2 webparts, 1 is the header and the other is the footer. Webpart 1 gets data from an external database, webpart 2 also needs this data.

The data is just displayed as labels, no datalist, repeaters, etc.

How can webpart 2 use the data that is retrieved from webpart 1. This is using the portal engine and I do not want each webpart to have to access the database for the same data.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/22/2011 11:09:21 AM
   
RE:Share data between webparts
Hi,

1.
You could access the instance guid via PageInfo object. From the PageInfo you can get the template information (PageTemplateInfo), now you are able to access the requested zone and get the list of available webpars. And, finally, from this list you could access guid information about appropriate webpart.

Here is a code example:

        
PageInfo pi = PageInfoProvider.GetPageInfo(...);
PageTemplateInfo pt = pi.PageTemplateInfo;
WebPartZoneInstance wpzi = pt.GetZone("zoneID");
ArrayList al = wpzi.WebParts;


2. Using CMS.Controls.CMSControlsHelper.GetFilter / SetFilter methods.

Best regards,
Ivana Tomanickova