我正在使用FlexiGrid jQuery插件,我需要從我的MVC應用程序中取回一個JSON對象,如果FlexiGrid只取對象,但我需要向響應字符串添加幾個項目才能正常工作與FlexiGrid。我怎樣才能得到一個JsonResult對象作爲一個字符串,所以我可以修改它?
因此,這裏是我的控制器代碼的一部分:
If Request.QueryString("json") IsNot Nothing Then
Dim data As New StringBuilder()
data.Append("page: " & pageIndex & "," & vbCrLf)
data.Append("total: " & ViewData.TotalCount & "," & vbCrLf)
data.Append("rows: ")
data.Append(Json(objCustomerList))
Return Content(data.ToString())
End If
不幸的是在上面的代碼Json(objCustomerList)
返回「System.Web.MVV.JsonResult」,而不是所期望的JSON字符串數據。我也嘗試Json(objCustomerList).ToString()
只是爲了看看會發生什麼,以及同樣的事情。
任何想法?
正是我需要的。感謝勺子和計算器 – Hcabnettek 2010-11-18 18:48:34