Calling a method with Ajax and returning a view

Aug 24 2020 5:24 PM
I have a method Show which returns a view Show with a model. I use that model to populate two Kendo grids.
In the Show view,  I have a button which on click, sends a model from the view to a method Save in the controller. 
Due to the fact that I call the Save method via an ajax call, I cannot return a view in the Save method. 
 
I tried two solutions.
 
I tried to create a third method, let's call it Test for the sake of the argument and I tried to use 
RedirectToAction from Save and redirect it to Test but I found out that RedirectToAction does not work with an ajax call.  
 
I decided to try with a partial view but it's also not working.
 
  1. public ActionResult SaveFile(List<Model> model, int type)  
  2.         {  
  3.                //code shortened for brevity  
  4.                return PartialView(model, type);  
  5.          }   
 
This also does not work. I am kind of stuck with this internship task I got with an existing .net core app and I am not sure how to proceed.  
 

Answers (1)