November Happy Hour will be moved to Thursday December 5th.

How do I retrieve property from another page?

Vote:
 
I have my menu structure like this: -Startpage |- Oslo |-Meldinger |-Nyheter |- Trondheim |-Meldinger |-Nyheter |- Bergen |- Stavanger The page type for Oslo has a property called MeldingID. Question: How can I retrieve the value of the property MeldingID when I'm on on my startpage, and I know the page ID for Oslo? In depth explanation: This site looks at where you are from (through login) and displays the sub menus accordingly. Hence, if you are from Oslo, you will not se the other pages (Bergen, tr.heim, stvgr). Now, the page Oslo has a property called "MessageID" of type Page. This allows me to manually browse the tree structure and find the page "Meldinger" that contains the messages. On front page (deafult.aspx) there is a section on the left side for displaying messages. If you are from Oslo, Oslo spesific message will show, and if you are from Bergen, Bergen specific messages will show. Example: This is what I do to retrieve ViktigMeldingID property from the Start Page template. if (!IsPostBack) { PageReference pl = ((PropertyPageReference)CurrentPage.Property["ViktigMeldingID"]).PageLink; VikitgMeldingControl.PageLink = pl; VikitgMeldingControl.DataBind(); } I can use CurrentPage.Property because the page loaded is default.aspx and it has a property called "ViktigMeldingID". But I cannot use this for the page Oslo, as this page is never shown and only used for structuring pages in Edit mode. I do however know the Page ID as this is retrieved for showing (sub) menu items.
#12955
Mar 06, 2007 11:16
Vote:
 
All you should need to do is something like the following, assuming the page or control you are adding this to inherits from an EPiServer base class (TemplatePage or UserControlBase). PageData osloPage = GetPage(new PageReference(osloPageId)); int meldingId = (int)osloPage["MeldingID"] --Jeremy.
#15149
Mar 06, 2007 20:52
Vote:
 
Great, that worked. Thanks! :-)
#15150
Mar 12, 2007 15:53
* 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.