2011-04-06 217 views
1
<%= Ajax.AjaxImageActionLink("../../Content/images/delete.png", "Feature", "Delete", new { id = item.int_FeatureId }, new AjaxOptions { UpdateTargetId = "table", HttpMethod = "Post", Confirm = "Delete Feature with Feature ID:" + item.int_FeatureId + " Feature Name:" + item.vcr_FeaturesName })%> pr 

我试图生成JavaScript弹出时按下删除链接是和不是。这在.aspx视图中完美工作,但我如何使它在剃刀中工作。我试着翻译,但没有工作asp.net mvc剃须刀是没有对话框不在剃须刀

@Ajax.ActionLink("Delete Profile", "Delete", new { id = item.int_UserId }, new AjaxOptions { UpdateTargetId = "UserTable", HttpMethod = "Post", Confirm = "Delete User with User ID:" + item.int_UserId + " User Name:" + item.vcr_UserName }) 

回答

0

如果你重写这个在剃刀正确,不工作,这绝对不是ASPX或剃刀的情况。它们只是解析器,使用它们中的任何一个都不会影响内部mvc代码的执行。同样在剃刀标记将刚刚取出的aspx代码结束标志,取而代之的起始标记“@”

@Ajax.AjaxImageActionLink("../../Content/images/delete.png", "Feature", "Delete", new { id = item.int_FeatureId }, new AjaxOptions { UpdateTargetId = "table", HttpMethod = "Post", Confirm = "Delete Feature with Feature ID:" + item.int_FeatureId + " Feature Name:" + item.vcr_FeaturesName }) 
0

我有以下错误,它似乎被什么东西做的剃刀引擎读取jQuery的方式函数捆绑或内部引用脚本时?我只是引用了cdn中的文件,它工作正常。这是你可能会尝试前者的错误。尝试引用cdn中的jquery文件,因为这可能是您的罪魁祸首。

Chrome debugger

似乎这样精细的工作。

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> 
    <script src="//code.jquery.com/jquery-1.9.1.js"></script> 
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>