asp.net mvc razor是的没有剃刀的对话框

时间:2011-04-06 07:43:26

标签: asp.net asp.net-mvc-3 razor

  <%= 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视图中完美无缺,但我怎样才能在剃须刀中使用它。我尝试翻译但不能正常工作

  @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 })

2 个答案:

答案 0 :(得分:0)

如果你正确地用剃刀重写它并且不起作用,那绝对不是aspx或razor的情况。它们只是解析器,使用它们中的任何一个都不会影响内部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 })

答案 1 :(得分: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>