ビューモデルを更新できません。
私は次のような見解を持っています:概要
私はこれをビューのコントローラーに持っています:
public ActionResult Overview()
{
var evo = new OverviewViewObject
{
MvcGridModel = new MvcGrid(),
SingleExportData = new SingleExportData()
};
return View(evo);
}
次に、[保存]ボタンを呼び出します。
$.ajax({
url: saveUrl,
cache: false,
type: "post",
data: JSON.stringify({ Name: myName }),
contentType: "application/json",
success: function (data) { .. }...
saveUrlは次の場所に移動します。
[HttpPost]
public ActionResult Save(MyDataType saveData)
{
//todo save logic here
var mvcGridModel = GetGridData();
var evo = new ExportDataOverviewViewObject
{
MvcGridModel = mvcGridModel ?? new MvcGrid(),
SaveData = new MyDataType()
};
return View("Overview", evo);
}
そして、保存でうまくいき、saveDataオブジェクトのデータをうまく取得し、最後までエラーを返しませんが、戻った後にビューが表示されると、データはそこに表示されなくなります。
手伝っていただけませんか?