渲染两个或多个局部视图
我有一个 Ajax.Actionlink ,它触发一个放置在我的控制器内的方法,该方法返回用户列表并呈现部分视图。
[Authorize]
public ActionResult UsersAddresses()
{
...
...
return PartialView("AddressesList",users);
}
有什么方法可以同时渲染两个或多个部分视图吗?
谢谢
I have an Ajax.Actionlink that fires to a method that is placed inside my controller which returns a list of users and renders a partial view.
[Authorize]
public ActionResult UsersAddresses()
{
...
...
return PartialView("AddressesList",users);
}
Is there any way how I can render two or more partial views at the same time?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只是尝试将部分视图连接在一起,请创建一个部分视图(我们将其称为“Parent”),然后在该视图中根据需要多次调用 Html.RenderPartial() 。然后,您的控制器只需返回父级的 View / PartialView,提供正确的聚合视图数据。
If you're just trying to concatenate partial views together, make a partial view (we'll just call it Parent), then within that view call Html.RenderPartial() as many times as you need. Then your controller can just return a View / PartialView for Parent, supplying the proper aggregate view data.