[英]error Unexpected character '$' in jQuery template script
I am working in mvc 4 C#.net 4.0, Visual Studio 2013. 我在MVC 4 C#.net 4.0,Visual Studio 2013中工作。
I am using jQuery template. 我正在使用jQuery模板。 As i am new to mvc and jquery and also for template
由于我是mvc和jquery以及模板的新手
Here is my script for template. 这是我的模板脚本。
I have add this 我添加了这个
<script src="~/Scripts/jquery.tmpl.js"></script>
<script src="~/Scripts/jquery.tmpl.min.js"></script>
<script type="text/x-jquery-tmpl" id="ScheduleRowTemplate">
<tr>
<td>
@Html.Label("", ${RowNo}, new { style = "width:100%" })
<input type="hidden" id="ItemIndex" value="${ItemIndex}" />
</td>
</tr>
</script>
In this script, Visual Studio generating error on $ signs. 在此脚本中,Visual Studio在$符号上生成错误。
Unexpected character '$' 意外字符“ $”
What should i do to remove this error? 我应该怎么做才能消除此错误? which thing i am missing here ?
我在这里想念哪件事?
You can't mix a server-side method like Html.Label
with a client-side variable like ${RowNo}
. 您不能将
Html.Label
这样的服务器端方法与${RowNo}
这样的客户端变量Html.Label
在一起。 Use HTML markup instead of the Razor helpers: 使用HTML标记而不是Razor帮助器:
<script type="text/x-jquery-tmpl" id="ScheduleRowTemplate">
<tr>
<td>
<label style="width: 100%">${RowNo}</label>
<input type="hidden" id="ItemIndex" value="${ItemIndex}" />
</td>
</tr>
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.