小编joh*_*doe的帖子

ASP.NET MVC 3中的部分视图缓存

如何在ASp.NET MVC 3中缓存PartialViews的输出?我知道我可以用[OutputCache]属性修饰动作,但我只想将@OutputCache包含在PartialView中,如下所示:

@OutputCacheAttribute

@model MvcApplication1.Models.someViewmodel

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>



@Html.Partial("_MyPartialView")
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc

11
推荐指数
1
解决办法
1万
查看次数

如何在不改变asp.net mvc中的路由的情况下更改操作参数并使其工作?

在我的路线中我有这样的事情:

controller/action/{id} 
Run Code Online (Sandbox Code Playgroud)

据我所知,这意味着它将使用参数id调用任何操作,如下所示:

public ActionResult Detail(string id) 
{
}
Run Code Online (Sandbox Code Playgroud)

如果不在global.asax文件中注册特定路由,我需要做什么才能完成以下工作:

public ActionResult Detail(string customerId) 
{
}
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc routing

6
推荐指数
2
解决办法
1626
查看次数

标签 统计

asp.net-mvc ×2

routing ×1