0

我有一个像这样的javacript:

<script>
    function GetFromDate() {    
        var dt1 = document.getElementById('fromDate').value;
        var dt2 = document.getElementById('toDate').value;
        var url = "Statistics/Excel/"  + dt1 + "!" + dt2;        
        window.location.href = url;
        return false;

    };
</script>

在控制器中我的 ActionResult 是这样的:

 public ActionResult Excel(string id)
        {
              \\ View Creation
               if(SomeLogic)
                  {
                         \\Excel Download Options
                  }
          return View(viewModel);
       }

虽然它与 Excel 下载选项完美配合,但它没有返回视图。有什么建议么?有关详细信息,“viewModel”对象包含要显示的完美数据。

4

1 回答 1

0

如果您的响应返回文件下载,那么这将被视为您的 Http 响应,那么您将无法在同一操作中执行重定向。

于 2013-08-22T09:34:51.513 回答