MVC3 未终止的字符串常量语法错误 [英] MVC3 unterminated string constant syntax error

查看:32
本文介绍了MVC3 未终止的字符串常量语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,它给了我一个语法错误 - 未终止的字符串常量.我已经匹配了引号似乎无法发现问题.有任何想法吗?它工作正常,语法错误很烦人.

I have the following code which gives me a syntax error - unterminated string constant.I've matched up the quotes can't seem to spot an issue. Any ideas? It works fine, the syntax error is just annoying.

  <input type="button" class="my-button" value="" name="back" onclick="location.href='@Url.Action(Model.Back.Step.ToString(), "MyController")'" />

推荐答案

你可以这样重写:

<input type="button" class="my-button" value="" name="back" 
     onclick="@("location.href='" 
        + Url.Action(Model.Back.Step.ToString(), "MyController")  
        + "'")" />

这篇关于MVC3 未终止的字符串常量语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆