2017-09-07 17 views
0

MVCプロジェクトのポップアップ確認メッセージボックスに問題があります。MVCで確認メッセージボックスが機能しない

は基本的に私は、次があります。

@foreach(document in Model.Documents) 
{ 
    @Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = 
    document.Id}, new { onclick = "return confirm('Are you sure you want to delete 
    this document"+ document.FileName +"?');", @class = "button small button 
    alert"}) 

} 

私は「+ document.FileName +」ポップアップ確認ボックスがトリガされていないのonclick関数内私はない渡すときには、上記の見ることができるようにそれがうまくいかない理由がわかりましたが、私が"+ document.FileName +"のようなポップアップメッセージボックスがポップアップしているような場合は、

@Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = document.Id},new { onclick = "return confirm('Are you sure you want to delete this document'?');", @class = "button small button alert"}) 

私は間違っていますか?私は行方不明の何かがあるかもしれませんか?これに代えて

@Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = 
    document.Id}, new { onclick = "return confirm('Are you sure you want to delete this document" + document.FileName + "?')", @class = "button small button alert" }) 

答えて

0

は、私は私が間違った形式がこれです持っていた自分自身をそれを考え出し

@Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = 
    document.Id}, new { onclick = "return confirm('Are you sure you want to delete 
    this document"+ document.FileName +"?');", @class = "button small button 
    alert"}) 
0

使用この

@foreach(var document in Model.Documents) 
{ 
    @Html.ActionLink("Delete", "DeleteDocument", "Document", new { @id = 
    document.Id, @onclick = "return confirm('Are you sure you want to delete 
    this document"+ document.FileName +"?');", @class = "button small button 
    alert"}) 

} 
関連する問題