Search code examples
user-controlsumbraco

Umbraco NodeByAlias?


I'm developing a custom datatype with the usercontrolwrapper in umbraco. I have some dataeditorsettings which I need the value of.

dynamic landkaart = new DynamicMedia(umbraco.library.GetPreValues(1100));
dynamic pointer = new DynamicMedia(umbraco.library.GetPreValues(1100));

As you can see I'm working with the GetPrevalue() method so I can access these values. The only problem now is that I do not want to hardcode those id's. I guess I need some method like NodeById(), except for the fact that I want it by property alias. Does anyone know a method like that, or knows a method which I can use to get the id of the property?


Solution

  • here is the solution i came up with:

    Document d = new Document(@Model.Id);
    var pt = d.getProperty(propAlias).PropertyType;
    var preVals = PreValues.GetPreValues(pt.DataTypeDefinition.Id);