Where's the content and properties?!

Vote:
 
Okay, this is probably really stupid, but where the heck to I get a page's property information from. I've created an array of PageReferences (to allow for sorting). Then I interate through the array and set a new PageData object based on the PageReference. I'd assumed that this would give me ALL the information from the page such as Property information and specific properties such as LinkURL, but all I get is the date the page is published. Here's the code: for (int i = 0; i < prArrayDate.Length; i++) { PageData thePage = new PageData((PageReference)prArrayArticle[i]); lblDummyData.Text += prArrayDate[i].ToString() + "
"; lblDummyData.Text += "" + thePage.Property["NewsTitle"].ToString() + "
"; lblDummyData.Text += thePage.Property["RightColumn_Content"] + "

"; //lblDummyData.Text += prArrayArticle[i] + "

"; }
When I hit the line setting the HREF, it bombs saying that it's not set to an object (neither the LinkURL nor the Property). Am I doing this wrong? Am I supposed to be setting this to something other than PageData? Please help. Thanks, Jordy
#13131
Jul 27, 2007 21:45
Vote:
 
Hi Jordan. The proper way to get a PageData object based on a PageReference is to use the GetPage(..) method like this: PageReference pr = new PageReference("123"); PageData thePage = EPiServer.Global.EPDataFactory.GetPage(pr); You can then get the PageData properties by accessing them like you tried, or directly: thepage["propertyname"]. It can be smart in advance to check if the properties exixts by using Exists(..) or IsValue(..). Check out the SDK for further information. If you are not familiar with the EPDataFactory library, I will recommend you to take a closer look at it as well. It contains some of the most important and used methods in most EPiServer projects. Good luck, -Geir Allan Hove Epinova AS
#15450
Jul 28, 2007 20:47
Vote:
 
Perfect! Thank you very much!
#15451
Jul 30, 2007 15:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.