2
我真的找不到任何示例如何將List<object>
轉換爲Json格式並在C#中填充<tbody>
?如何將列表<object>轉換爲Json格式並在C#中填充<tbody>?
List result = new List();
MyClass m1 = new MyClass();
MyClass m2 = new MyClass();
result.Add(m1);
result.Add(m2);
return Json(???);
$.post("/Tradeshow/AddTradeShowDetail", {
startdate: $('#cstartdate').val(),
enddate: $('#cenddate').val(),
location: $('#clocation').val(),
speakerid: $('#TradeshowSpeakers').val(),
isnonspeaker: value
},
function (data) {
if (data.length > 0) {
// Populate <tbody> ???
}
});
什麼是MyClass?它是可序列化的嗎?另外,假設MVC給出'return Json()'是否安全? – 2012-01-31 02:05:50
http://stackoverflow.com/questions/7087312/how-to-convert-a-listt-to-specific-json-format檢查此 – 2012-01-31 02:06:24
你試過嗎? http://stackoverflow.com/a/6366183/639960 – Akhil 2012-01-31 02:06:44