2011-04-06 218 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>