C# MVC No submit pass object between views

 ̄綄美尐妖づ 提交于 2019-12-02 01:16:17

Why don't you use the AJAX for pass the data?

    function ChargeViewModel() {
        this.Description ='';
        this.IsMultipleMatch =false;

    }

    var chargeViewModel= new ChargeViewModel();
    var data = JSON.stringify({ 'chargeViewModel': chargeViewModel });

    $.ajax({
        contentType: 'application/json; charset=utf-8',
        dataType: 'html',
        type: 'POST',
        url: '@Url.Action("LoadLoanChargeDescriptions", "LoanChargeController")',
        data: data,
        success: function (result) {
           //result will be your partial page html output
        },
        failure: function (response) {

        }
    });

Then you have to change the controller like this:

public ActionResult LoadLoanChargeDescriptions(ChargeViewModel chargeViewModel)
  {
      // get data here and pass/work on
      return View("_PartialMultipleMatchPopup", null);
  }

Let me know you have queries..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!