We get a null-reference exception when using either item.GetValue("myproperty") as ListViewModel or item.GetValue<ListViewModel>("myproperty") if no properties are selected on the item value.
If any other experience this issue, you may use this small extension untill Dynamicweb gets it fixed:
public static class GetListViewValueExtensions
{
public static string GetSelectedValue(this Dynamicweb.Frontend.ItemViewModel item, string name)
{
try
{
var listViewModel = item.GetValue(name) as ListViewModel;
if (listViewModel == null) return "";
return listViewModel.SelectedValue;
}
catch(Exception e)
{
return "";
}
}
}