如何更改Ajax.ActionLink GET / POST网址格式

时间:2016-07-01 06:42:50

标签: asp.net asp.net-mvc actionlink

我正在发出Ajax.ActionLink这样的获取请求

@Ajax.ActionLink("Create New", "Create", new { Module  = (string)ViewBag.Module } ,new AjaxOptions { HttpMethod = "Get",
    UpdateTargetId = "DivCreate",
    InsertionMode = InsertionMode.Replace})
  

这里Master是Controller Name,Create是ActionMethod,Module是querystring

生成以下链接

http://localhost:49598/Master/Create?Module=department

因为我已经像这样配置了我的RouteConfig

  routes.MapRoute(
             "Master",
             "Master/{Module}/{action}/{Id}",
              new { controller = "Master", action = "Index", Module = UrlParameter.Optional, Id = UrlParameter.Optional }
                  );

我想要的结果

http://localhost:49598/Master/department/create  // this link is working

我的创建方法

  public ActionResult Create(string Module)
        {
            ViewBag.Module = Module;
            return PartialView("Pcreate");
        }

PS:如果可能,我不想改变我的RouteConfig

任何帮助?

0 个答案:

没有答案