0

我已经在我的 MVC 5 页面上实现了剑道上下文菜单和网格。我需要通过将 requestid 传递给它来导航到另一个页面。当我尝试调用 @{Html.RenderAction("NewRequest_Read", "Request");} 它会预先加载视图以及包含上下文菜单的视图。有人能告诉我该怎么做吗

上下文菜单

 @(Html.Kendo().ContextMenu()
        .Name("RequestMenu")
        .Target("#GridRequest")
        .Filter("tr")
        .Orientation(ContextMenuOrientation.Vertical)
        .Animation(animation =>
        {
            animation.Open(open =>
            {
                open.Fade(FadeDirection.In);
                open.Duration(500);
            });
        })
         .Items(items =>
         {
             items.Add()
                 .Text("Edit");

             items.Add()
                  .Text("Cancel");
         })

         .Events(e =>
         {
             e.Select("onSelect");

         })
    )

脚本

function onSelect(e) {
    var grid = $("#GridTeam").data("kendoGrid");


    switch ($(e.item).children(".k-link").text()) {

        case "Edit":
            @{Html.RenderAction("NewRequest_Read", "Request");}

            break;
        case "Cancel":
            grid.removeRow(e.target);
            break;
    }
}

控制器方法

  public ActionResult NewRequest_Read(string id)
        {
            NewRequestViewModel newReqeustViewModel = new NewRequestViewModel();
            return View("NewRequestView", newReqeustViewModel);
        }
4

1 回答 1

0
function onSelect(e) {
var grid = $("#GridTeam").data("kendoGrid");

switch ($(e.item).children(".k-link").text()) {
    case "Edit":
        window.location.href = '@Url.Action("NewRequest_Read", "Request", new { id = //add request id parameter here })';
        break;
    case "Cancel":
        grid.removeRow(e.target);
        break;
}

}

于 2017-04-18T12:42:23.693 回答