//[Authorize] public ActionResult FileAssociate(string fileName) { Session["currentFileProcessed"] = fileName; ViewBag.Message = "It's FileAssociate Time"; // Populate the list of Persons /* Following code works */ // nodeList = PersonDB.GetPersons(); var artifactList = PersonDB.GetPersonsNames(); int ttlNumOfNames = artifactList.Count; List <string> artifactNames = new List <string>(); artifactNames = PersonDB.GetNamesByFile(fileName); //check the box on the screen for Persons currently associated with the file int ttlNumberOfNames = artifactNames.Count; for (int i = 0; i < ttlNumberOfNames; i++) { for (int x = 0; x < ttlNumOfNames; x++) { if (artifactNames[i] == artifactList[x].Name) { artifactList[x].IfChecked = true; // check the checkbox in artifactNames list } } } return(View(artifactList)); }