Reputation: 2691
What is the difference between accessing a property through page["propertyName"] and page.Property["propertyName"] in EPiServer?
Thanx!
Upvotes: 0
Views: 561
Reputation: 7391
As Bjorn said:
CurrentPage["PropertyName"] is the same as CurrentPage.Property["PropertyName"].Value.
Upvotes: 0
Reputation: 76
page["PropName"] uses the indexer of the PageData class to return the Value of the PropertyData object.
page.Property["PropName"] will return the whole PropertyData object (for example a PropertyLongString)
so page["PropName"] equals page.Property["PropName"].Value
Upvotes: 1
Reputation: 1086
Don't know exactly. But...
I always use page["PropName"] which I know works with "Fetch data from" and "Dynamic properties" and when you have a writable page it also works for setting a value.
Judging by code I've seen from multiple partners and at EPiServer courses it's the most common way too.
You can look at the implementation here and find out exactly: http://sdk.episerver.com/library/cms5/html/T_EPiServer_Core_PageData.htm
Upvotes: 0