我想我有一個很小白的問題,但它就在那裏撒嬌控制器,我想傳遞一個字符串列表。列表<string>獲取與「System.Collections.Generic.List`1 [System.String]」
控制器:
[HttpPost]
public ActionResult Index(DateTime? dateFilter, int? Provider, int? middleOffice)
{
...
ViewBag.ReasonGroupName = new List<string>() { "Faults" };
...
}
查看:
@Html.ActionLink(item.username, "Edit", "Hours", new { IdUser = item.IdUser, ReasonGroupNames = (List<string>)ViewBag.ReasonGroupName }, new { @class = "iframeFull" })
在我的控制器ViewBag.ReasonGroupName
正確創建:隨着指數0項目的列表([0])與串"Faults"
但是當我接收它在我的其他控制器我的列表中的0索引元素自帶"System.Collections.Generic.List1[System.String]"
而不是"Faults"
I也嘗試更改ViewBag
爲ViewData
對象,但出現同樣的問題。
任何意見我做錯了什麼?
感謝
另一個控制器得到一個索引爲0的列表有一個String值'「System.Collections.Generic.List1 [System.String]」'?或者也許另一個控制器得到一個列表,在第0個元素裏面有另一個列表?我想你也應該向我們展示其他控制器的代碼。 – quetzalcoatl
「編輯」操作的外觀如何? –
編輯操作非常簡單:'public ActionResult Edit(long IdUser,List ReasonGroupNames){var table = LoadEdit(IdUser,ReasonGroupNames);返回查看(表);}' –