JsonConvert System.ArgumentNullException : 'Value cannot be null. Arg_ParamName_Name'

sblb 1,166 Reputation points
2022-07-12T14:11:32.053+00:00

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
219951-image.png

I received this message : 219855-image.png
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]
219800-image.png

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,190 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
{count} vote

19 answers

Sort by: Most helpful
  1. sblb 1,166 Reputation points
    2022-07-15T16:04:18.053+00:00

    What I find very confusing is the jstree can display a directory structure. The jstree site even has an example. Why you are still messing with the jQuery DataTable is a mystery.

    I think I will come back jQuery DataTable and I will add dropdown to select the repository to filter into the DataTable. here how-display-directories-and-files-to-open-the-file.html

    I was able to populate the dropdown box with the directories from the database. It's missing one thing parse the value selected in dorpdown box to filter in DataTable.

    Thanks to your support.


  2. 无敌霸王龙 0 Reputation points
    2023-02-02T15:19:27.0433333+00:00

    I tried to do the tree view structure

    0 comments No comments

  3. 无敌霸王龙 0 Reputation points
    2023-02-02T15:23:03.11+00:00

    。。。。。。。。。。

    0 comments No comments

  4. 无敌霸王龙 0 Reputation points
    2023-02-02T15:23:28.7833333+00:00

    。。。。。。。。。。。

    0 comments No comments