ViewData["results"] = indication.Model.prepaymentList;
return View(@"~\Views\Indications\TermSheetViews\Swap\PrePayment.aspx", indication.Model);
This works fine but my compilation error is happening on the view on this line:
var prepaymentList = <%= ViewData["results"]; %>;
What's wrong?
A quick guess: try removing ;
after ]
You have too many ;
. It should be:
var prepaymentList = <%= ViewData["results"] %>;
Of course writing something like this makes absolutely no sense whatsoever.
You probably need:
var prepaymentList = <%= new JavaScriptSerializer().Serialize(ViewData["results"]) %>;
Which of course leads to another problem which is the usage of ViewData
. I would recommend you using a strongly typed view and model so that finally you have:
var prepaymentList = <%= new JavaScriptSerializer().Serialize(Model) %>;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.