Hi, I tried to do the tree view structure.
The code behind is
public string TreeViewJSON { get; set; }
public void OnGet()
{
List<TreeViewNode> nodes = new List<TreeViewNode>();
//Loop and add the Parent Nodes.
foreach (FilePathP type in context.FilePathPs)
{
nodes.Add(new TreeViewNode { id = type.Id.ToString(), parent = "#",text = type.Name});
}
//Loop and add the Child Nodes.
foreach(FilePathP subtype in context.FilePathPs)
{
nodes.Add(new TreeViewNode { id = subtype.OrgLevel.ToString() + "-" + subtype.Id.ToString() ,
parent = subtype.OrgLevel.ToString(), text = subtype.Name});
}
// Serialize to JSON string.
this.TreeViewJSON = JsonConvert.SerializeObject(nodes);
}
public void OnPostSubmit(string selectedItems)
{
List<TreeViewNode> items = JsonConvert.DeserializeObject<List<TreeViewNode>>(selectedItems);
}
The data come from the sql view
I received this message :
I don't understand why I received this message because the list not null.
Have you an idea about this message and how I can solve it?
one thing that is disturbing is that I have the node counter set to 68 and it displays null values from [68] to [127]