Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何动态加载部分视图?我尝试使用如下查询字符串,但运行时出错。
我的代码:
@Html.Partial("_Sample?id=3")
您可以执行以下操作:
@Html.Action("Sample", "Users", new { UserId = 1 })
在你的UsersController:
UsersController
[ChildActionOnly] public ActionResult Sample(int UserId) { // do stuff here }