MVC4中的警报框?

时间:2013-05-17 06:26:45

标签: javascript asp.net-mvc

这就是我正在尝试为ActionLink制作一个警告框。但它不起作用。

@Html.ActionLink("ADD", "BrandListComfirmed", new { id = item.brand_id }, new { onsubmit = "return confirm('Are u sure you want this brand? " + item.brand_name + "');" })

1 个答案:

答案 0 :(得分:5)

锚点没有onsubmit事件。请改用onclick

@Html.ActionLink(
    "ADD", 
    "BrandListComfirmed", 
    new { 
        id = item.brand_id 
    }, 
    new { 
        onclick = "return confirm('Are u sure you want this brand? " + item.brand_name + "');" 
    }
)