I'd like to programmatically access the type of a property. So I'll fetch the property the conventional way, and then I'd like to grab the bit that specifies whether it's:
While I'm at it, I also need to access the tab it belongs to. So when adding a property, it's the dropdown that is labelled with:
"Place under heading:"
Let's see, you should be able to get them using something like this:
Tab:TabDefinition tab = CurrentPage.Property["myProp"].Tab;
Property type name:string propTypeName = PageDefinition.Load(CurrentPage.Property["myProp"].PageDefinitionID).Type.LocalizedName;
I've not actually tested this, so I may have made some stupid error, but something along those lines should give you what you want.
Per GunsarfsEPiServer CMS development team
Thanks for getting back to me so quickly!
I've tried both of those suggestions, but no luck.
There's no tab property, but there is a ownertab property!
I used this:TabDefinition tab = TabDefinition.Load(propData.OwnerTab);
And for my type, that code worked exactly, though I had to catch the empty types!
Thanks very much!
Sorry, doublechecked and you are correct there is no Tab property on PropertyData, don't know how I read the SDK yesterday. It's of course PageDefinition that has a Tab property But it seems like you solved your problems anyway :)
If these kind of problems my suggestion is to start with the classes PropertyData and PageDefinition. From there you can get most such information.
Yep, all sorted!
Thanks anyway Per,