Developer forum

Forum » Development » Getting Item properties from pages?

Getting Item properties from pages?

Thomas Berthelsen
Reply

Hello.

I'm trying to get a property from a page, that we're using to determine if one should show a button (for every page).

However i'm unable to get the value in the razor file.

The item has systemname: PageProperties, with the checkbox (bool) having systemname NewsletterButton.

I think the logical thing to do was something like:

var newsletterButton = Model.Item.GetItem("PageProperties");
    var newslet = newsletterButton.GetValue("NewsletterButton");

but that does not work, is there a special way to get item page properties in DW?

Thomas

tempsnip.png

Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
 
Thomas Berthelsen
Reply

issue is solved, for people who are looking for similar, got the value by doing:

Model.PropertyItem.Fields.First(f => f.SystemName == "NewsletterButton").GetBoolean();

Thomas

 

You must be logged in to post in the forum