I am having an observable array with a list of view model data which i need to pass to Normal controller which is having a return type of ActionResult
public ActionResult Index(list<qualities> data)
{
return excelCon.DownloadTMExcel(data); //here i get actionResult as ReturnType
}
Java script code :
var URL = "/DownloadExcel/Index?data="+self.qualities(); //self.qualities holds my entire list which hits break point in controller but i get Zero list .
window.open(URL, "_blank");
Actually the excat scenario is when everything works fine i get excelsheet downloded with new window open .
I need advice in how to pass observableArray like the way i am dealing .
I tired also something like :
var URL = "/DownloadExcel/Index?data="+ko.toJson(self.qualities()); //this dont to controller itself
I tried using Ajax call still it works one way i.e i can pass ObservableArray but ActionResult return Type it can't handle . always it goes to error function of ajax call and i wont get my excel downloaded .
The only case worked for me : There is other scenario i just need to pass parameters to controller then i am able to open a new window and download relevant excel .
var URL = "/DownloadExcel/Index?typeId="+2;
window.open(URL, "_blank"); //on open of new window i get excel downloaded
In Additional :
[HttpPost]
public ActionResult Index(list<qualities> data) // i get count ZERO
{
return View();
}
Using string Parameter
[HttpPost]
public ActionResult Index(string data) //break point at controller not even hitting
{
return View();
}
Any help is dearly appreciated .