在mvc2.0 的时候
<%= Html.ActionLink("编辑", "updateProduct", new { id=item.ID})%>
形成的链接是:updateProduct?id=1到了mvc3.0
@Html.ActionLink("编辑", "updateProduct", new { id=item.ID})
就变成updateProduct/1我的问题是,我还想像2.0那样,有什么办法吗?
我尝试这样写:
@Html.ActionLink("编辑", "updateProduct?id=" + item.ID)
但url是这样的:updateProduct%3fid%3d2,被编码了
有什么办法吗
<%= Html.ActionLink("编辑", "updateProduct", new { id=item.ID})%>
形成的链接是:updateProduct?id=1到了mvc3.0
@Html.ActionLink("编辑", "updateProduct", new { id=item.ID})
就变成updateProduct/1我的问题是,我还想像2.0那样,有什么办法吗?
我尝试这样写:
@Html.ActionLink("编辑", "updateProduct?id=" + item.ID)
但url是这样的:updateProduct%3fid%3d2,被编码了
有什么办法吗
{
Url = "[controller]/[action]/[id]",
Defaults = new { action = "Index", id = (string)null } ,
RouteHandler = typeof(MvcRouteHandler)
});
=> RouteTable.Routes.Add(new Route
{
Url = "[controller]/[action]/?id=[id]",
Defaults = new { action = "Index", id = (string)null } ,
RouteHandler = typeof(MvcRouteHandler)
});
其余不要动
updateProduct?id=1&pageIndex=1&pageSize=10跟Routes 没关系啊。