【问题标题】:asp.net mvc razor yes no dialog not coming in razorasp.net mvc razor 是 否 对话框没有进入 razor
【发布时间】:2011-04-06 07:43:25
【问题描述】:
  <%= 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 })

【问题讨论】:

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


    【解决方案1】:

    如果您在 razor 中正确地重写了它并且无法正常工作,那么 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 })
    

    【讨论】:

      【解决方案2】:

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

      这种方式似乎可以正常工作。

       <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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-10-17
        • 2017-05-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-14
        • 1970-01-01
        相关资源
        最近更新 更多