消息确认框在MVC中不起作用 [英] Message confirmation box not working in MVC
问题描述
大家好,
我的MVC项目中的弹出确认消息框出现问题。
基本上我有以下内容:
Hi All,
I'm having an issue with my Popup confirmation message box in my MVC project.
basically i have the following:
//document.FileName is the file name i'm returning from the database
@Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = document.Id, caseId = document.CaseId },
new { onclick = "return confirm('Are you sure you want to delete this document'"+ document.FileName +"'?');", @class = "button small button alert"})
当我触发上面的ActionLink时,弹出确认框根本没有弹出。
但是当我有以下内容时:
When i trigger the ActionLink above the popup confirmation box does not pop up at all.
but when i have the following :
@Html.ActionLink("Delete", "DeleteDocument", "Document", new { id = document.Id, caseId = document.CaseId },
new { onclick = "return confirm('Are you sure you want to delete this document'?');", @class = "button small button alert"})
没有document.FileNa的
我作为一个参数,弹出框工作。
我做错了什么?
有人可以对此有所了解。< br $> b $ b
我尝试了什么:
我试图谷歌和移动周围的事情,但仍然没有运气,我现在有点耐心了
without the document.FileName as a parameter the pop up box works.
What am i doing wrong?
could someone shed some light on this please.
What I have tried:
I have tried to google and move things around but still no luck and i'm kinda running out patience now
推荐答案
改变这个:
Change this:
@Html.ActionLink("Delete", "DeleteDocument", "Document",
new { id = document.Id, caseId = document.CaseId },
new { onclick = "return confirm('Are you sure you want to delete this document'"+
document.FileName +"'?');", @class = "button small button alert"})
到此:
to this:
@Html.ActionLink("Delete", "DeleteDocument", "Document",
new { id = Model[0].ToString(), caseId = Model[0].ToString() },
new { onclick = "return confirm('Are you sure you want to delete this document " +
document.FileName + "?');", @class = "button small button alert" })
这篇关于消息确认框在MVC中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!