Try our conversational search powered by Generative AI!

EPiServer property: get attribute of property?

Vote:
 

Hi,

i am trying to get the attributes of my properties:

Example:

XXXPageBase : PageData

[Display(Name = "My Property 1", Description = "Property One", Order = 100, GroupName = Global.GroupNames.Specialized)]
[UIHint("MyUIHint")]
public virtual string MyProp { get; set; }

And then on Published event:
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class CustomizedRenderingInitialization : IInitializableModule

...........

private void Events_PublishingContent(object sender, ContentEventArgs e)
{
if (e.Content is XXXPageBase )
{
var page = e.Content as XXXPageBase ;

????How do i get the attribute of property: MyProp ????

I would like to get hold of the Description and UiHint value


}
}

#151646
Aug 02, 2016 15:14
Vote:
 

You might get some help from this blog post: http://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2014/3/Attribute-based-default-values/

#151647
Aug 02, 2016 15:35
Vote:
 
#151648
Aug 02, 2016 15:37
Vote:
 

Lovely guys, thank you.

I was doing it all wrong. Trying to get the attribute from page.Property (the property collection ).

Once again thanks alot 

#151649
Aug 02, 2016 15:39
* 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.