Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Webpart load order View modes: 
User avatar
Member
Member
ap - 4/10/2013 10:41:44 AM
   
Webpart load order
Hello.
Let's say i have a 2 webparts.
#1 set's a session value in the page_init function.
#2 is a repeater which reads the session value into it's wherecondition.

the problem i'm having is the repeater binds before the session value is set. how can i set the load order of each webpart.

thanks.
AP

User avatar
Member
Member
ap - 4/10/2013 10:49:31 AM
   
RE:Webpart load order
I should mention that the session value is read into the wherecondition via GlobalResolverExtenderAttribute macros

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/10/2013 2:51:17 PM
   
RE:Webpart load order
In webpart 1, set the session as needed, in webpart 2, get the value and set the where condition and reload the data, most likely in the prerender or pageload events. Make sure you're overriding those events.

User avatar
Member
Member
ap - 4/10/2013 3:49:16 PM
   
RE:Webpart load order
Thanks for the reply.

Reloading the data is an option, however this means it will essentially load the data twice. I'm looking for a way to achieve this on the first go, our site has literally millions of users and will make a significant difference.

User avatar
Member
Member
ap - 4/16/2013 1:23:35 PM
   
RE:Webpart load order
any other ideas?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/16/2013 3:01:47 PM
   
RE:Webpart load order
Understood. You could also set DelayedLoading = true for the second webpart. This will slow the binding process for you and allow you to set/get the other values and load the second webparts

If you choose the first option I suggested, you need to really understand the page lifecycle of the webpart and when content is loaded and controls are databound to understand I believe. Both webparts cannot load at the same time.

Heres an example:

Webpart 1 OnContentLoaded
Webpart 2 OnContentLoaded

Webpart 1 OnInit
Webpart 2 OnInit

Webpart 1 OnLoad
Webpart 2 OnLoad

Webpart 1 OnPreRender
Webpart 2 OnPreRender

So if you make sure webpart 1 is loaded first, webpart 2 should be able to get the value you need from session when the OnContentLoaded event happens and load the values you need.