1
Vote

Index out of range when connecting web part

description

I got an index out of range error when connecting the filter to my list view. This is because the array index is pre-incremented in the loop in the Schema property rather than post-incremented.

I fixed it by replacing the implementation of the Schema property with the one below:
public PropertyDescriptorCollection Schema
        {
            get
            {
                TypeDescriptor.GetProperties(this);
                return new PropertyDescriptorCollection(Parameters.Cast<PropertyDescriptor>().Where(objProperty => Parameters[objProperty.Name] != null).ToArray());                
            }
        }

comments