Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 错误:意外字符'$';在jQuery模板脚本中_C#_Jquery_Asp.net Mvc 4_Visual Studio 2013_Jquery Templates - Fatal编程技术网

C# 错误:意外字符'$';在jQuery模板脚本中

C# 错误:意外字符'$';在jQuery模板脚本中,c#,jquery,asp.net-mvc-4,visual-studio-2013,jquery-templates,C#,Jquery,Asp.net Mvc 4,Visual Studio 2013,Jquery Templates,我在Visual Studio 2013的mvc 4.net 4.0中工作 我正在使用jQuery模板。因为我不熟悉mvc和jquery,也不熟悉模板 这是我的模板脚本 我必须补充这一点 <script src="~/Scripts/jquery.tmpl.js"></script> <script src="~/Scripts/jquery.tmpl.min.js"></script> <script type="text/x-jquer

我在Visual Studio 2013的mvc 4.net 4.0中工作

我正在使用jQuery模板。因为我不熟悉mvc和jquery,也不熟悉模板

这是我的模板脚本

我必须补充这一点

<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>

@Label(“,${RowNo},新的{style=“width:100%”)
在此脚本中,Visual Studio在$符号上生成错误

意外字符“$”


我应该如何删除此错误?这里我遗漏了什么?

不能将
Html.Label
这样的服务器端方法与
${RowNo}
这样的客户端变量混合使用。使用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>

${RowNo}

不能将
Html.Label等服务器端方法与
${RowNo}
等客户端变量混合使用。使用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>

${RowNo}