Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Issues with Dynamicweb 9.3 Selection lists

Issues with Dynamicweb 9.3 Selection lists

Søren Heide Larsen
Søren Heide Larsen
Reply

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 "";
            }
        }
    }

 


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Søren,

I am unable to reproduce that on 9.3.4

Do you get an exception when you call GetValue(name)?
Do you get an exception when using the SelectedValue property because the list is null?

Can you provide a stack trace and maybe share the item type xml?

I would like to fix this, but first I need to know what the actual problem is :)

Best regards,
Morten

 
Søren Heide Larsen
Søren Heide Larsen
Reply

Hi Morten,

I get the exception from within GetValue, which is why I had to do the try/catch. The stack-trace does not really show anything more as I in that moment did not have the pdb files.

/Søren

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I'm still unable to reproduce this on a clean 9.3.4 installation using the attached item type that includes all kinds of lists.
I think we need a copy of the site (application, files, database) in order to reproduce it.

/Morten

 

You must be logged in to post in the forum