Newbie Question Nr.3

Vote:
 

Hello everyone, its monday and I hope you all had a nice weekend!

Its the happy student back with another newbie question, note: I am working on/learning in episerver 4.60.

I am making a usercontrol that inherits from EPiServer.UserControlBase, and it is placed on the mainpage. It needs to access propertys from another page, how do I go about doing that?

Kind Regards
Pontus

#28947
Mar 30, 2009 13:31
Vote:
 

Just load the page.

Something like (untested code from the top of my head :) ):

PageData page = Global.EPDatafactory.GetPage(new PageReference(page_id));

label1.text = page["mainbody"]  as string;

#28948
Mar 30, 2009 14:20
Vote:
 
Ok problem solved, thank you Greger!
#28950
Mar 30, 2009 14:47
Vote:
 

or page.Property["mainbody"] to get the value as a porperty.

page["mainbody"] will return the "inner" value of a property while using the Property[]will give you the value as the property.

#28967
Mar 30, 2009 23:30