MVC3 unterminated string constant syntax error

前端 未结 2 970
梦毁少年i
梦毁少年i 2020-12-17 01:04

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

相关标签:
2条回答
  • 2020-12-17 01:47

    You can rewrite it like this:

    <input type="button" class="my-button" value="" name="back" 
         onclick="@("location.href='" 
            + Url.Action(Model.Back.Step.ToString(), "MyController")  
            + "'")" />
    
    0 讨论(0)
  • 2020-12-17 01:58

    Use an actionlink instead. This one creates a nice bootstrap button:

    @Html.ActionLink("Cancel", "Index", "Home", null, new { @class = "btn btn-default" })
    
    0 讨论(0)
提交回复
热议问题