エラーがあります='@
終了していない文字列定数
<input class="blue" type="button" onclick="location.href='@(Url.Action("Index", "Home", Model.RouteData))';" value="Index"/>
これを解決するには?
エラーがあります='@
終了していない文字列定数
<input class="blue" type="button" onclick="location.href='@(Url.Action("Index", "Home", Model.RouteData))';" value="Index"/>
これを解決するには?
<input class="blue" type="button" onclick="location.href='@(Url.Action(\"Index\", \"Home\", Model.RouteData))';" value="Index"/>
これはうまくいくはずです。ただし、インライン CSS/JS の使用は本当に制限する必要があります。
このようなものが良いはずです。
HTML
<input id="button" class="blue" type="button" value="Index"/>
JS
document.getElementById("button").onclick= function(){
location.href='@(Url.Action("Index", "Home", Model.RouteData))';
}
文字列定数は、引用符のペアで囲む必要があります。
これを試して-
<input class="blue" type="button" onclick="location.href='@(Url.Action('"Index"', '"Home"', Model.RouteData))';" value="Index"/>