Using the contentpicker2 with the UDI. Need to grab the selected content item in an eventhandler with ContentService or IContent.GetValue<> but there doesnt seam to any propertyvalueconverters or methods that can use the UDI that is stored.
string test = umb://document/53d62b4d52d2414fb0882d263cfd6e85;
var udi = Udi.Parse(test);
var page = Services.ContentService.GetById(udi);**
var udiAsString = "umb://document/53d62b4d52d2414fb0882d263cfd6e85";
var udiSubString = udiAsString.Substring(udiAsString.Length - 32);
var guid = Guid.ParseExact(udiSubString, "N");
var page = Services.ContentService.GetById(guid);
or
string test = "umb://document/53d62b4d52d2414fb0882d263cfd6e85";
var udi = Udi.Parse(test);
var cachedPage = Umbraco.Content(udi);
var page = Services.ContentService.GetById(cachedPage.Id);
UDI and ContentService / GetValue<>
Using the contentpicker2 with the UDI. Need to grab the selected content item in an eventhandler with ContentService or IContent.GetValue<> but there doesnt seam to any propertyvalueconverters or methods that can use the UDI that is stored.
this code is error.please help me.
Hi Aung.
You can do 2 things.
or
Beats me why there isn't a simple ontentService.GetByIUdi(..)
Anyway, another solution is:
is working on a reply...