FirstController.cs
I have list of records in table with checkbox in each row, List of string values are selected by checking the checkbox.
public ActionResult Select(bool isChecked, String id)
{
var selectList = (List<String>)HttpContext.Session["SelectList"] ?? new List<String>();
if (isChecked && !selectList.Contains(id))
selectList.Add(id); } else if (!isChecked && selectList.Contains(id))
selectList.RemoveAll(s => s == id);
}
ViewBag.selectList = selectList;
return Content("OK"); }
public ActionResult AddSitesToUser(string returnUrl,string selectList, int userId = 0)
(Html.BeginForm("AddSitesToUser", "User", new { returnUrl = ViewBag.returnUrl,selectList=((List<string>)ViewBag.selectList )})
In my FirstController.cs the list of ViewBag.selectList = selectList; created properly, but if i pass those list of strings to SecondController.cs instead of returning list of strings it gives me '"System.Collections.Generic.List1[System.String]"
Any idea on what I'm doing wrong?
Thanks