我正在编写一个asp net core应用程序.
我想要实现的是使用 Javascript读取视图中的模型.
我找到了这段代码,但是当我运行它时,我收到此错误:
我想要实现的是使用 Javascript读取视图中的模型.
我找到了这段代码,但是当我运行它时,我收到此错误:
‘IJsonHelper’ does not contain a deFinition for ‘Encode’ and no extension method ‘Encode’ accepting a first argument of type ‘IJsonHelper’ Could be found (are you missing a using directive or an assembly reference?)
我该怎么办呢?
调节器
public async Task<IActionResult> Index() { return View(await _context.Bolla.ToListAsync()); }
视图
@model IEnumerable<ps0001.Models.Bolla> <script> var bolla = @Html.Raw(Json.Encode(Model)); </script>
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。