asp.net-mvc – 为什么在为JavaScript分配Model值时ASP.Net MVC 2.0中没有intellisense?

我正在尝试在我的内容页面中将一些模型属性添加到我的 JavaScript中:
$(document).ready(function () {
    createPager(1,<%=Model.TotalPages %>);
    createUnprocessedPager(1,<%=Model.TotalUnprocessedPages %>);
});

有谁知道这是否是设计的?你不打算将模型属性与JavaScript结合起来吗?或者这是一个错误

这按预期工作.但是,我在<%...%>中没有任何Intellisense.实际编写代码时的标签.如果我在< script>中编写任何代码标签,然后没有Intellisense.如果我直接进入标签< / script>并输入<%Model ....%>然后热潮,我又有了Intellisense.

更新:22/10/2010

刚刚阅读Scott Guthrie’s latest blog post,看来这个功能即将推出ASP.Net MVC 3即将发布(可能还有测试版):

Note: Visual Studio Code/Markup
Intellisense and Colorization within
Razor files aren’t enabled yet with
the Beta earlier this month. You’ll
see this show up in a few weeks though
– and it will support full code
intellisense for HTML,JavaScript,CSS
and C#/VB code within Razor files.

解决方法

你会在引号“”之类的视图中忽略Intellisense.
<input type="text" value="<%= DateTime.Today.ToShortDateString() %>" />

或者它是否出现在Javascript块中.

<script type="text/javascript">
    <%= DateTime.Today.ToShortDateString() %>
    </script>

我认为在这些场景中应该有Intellisense,所以我想说这是一个bug,希望Visual Studio的未来更新能够解决这个问题.

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...