I have a simple class that includes 2 properties, one row and one list of shared objects. It looks like this:
public class SessionFieldViewModel
{
private String _name;
public String Name
{
get { return _name; }
set { _name = value; }
}
private List<Object> _value;
public List<Object> Value
{
get { return _value ?? new List<Object>(); }
set { _value = value; }
}
}
In my main code (MVC Controller) I am trying to manually populate this class manually. Keep in mind that when I submit data from a web form to this class using standard model binding, it fills very well.
When I manually try to create an entry and add it to the list, I do this:
Guid id = Guid.NewGuid();
var _searchField = new SessionFieldViewModel();
_searchField.Name = "IDGUID";
Object _object = (Object)id;
_searchField.Value.Add(_object);
_searchFields.Fields.Add(_searchField);
When I do this, I get a populated class with the Name property "IDGUID", but shared object lists are returned null.
When I debug the code and go through it, although the data seems to work there, how I do it, but when I go through and check the _searchFields, it shows nothing in the Value property of the fields.
Ideas?
Thanks in advance.
Tom tlatourelle