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.
将可重用代码插入 cshtml razor 文件的最佳方法是什么。我需要将数据从外循环传递到用户控件。我拍了一张我正在尝试做的事情的照片,希望这会很清楚。
利用
@Html.RenderPartial(<virtual path to your partial view>, session);
其中局部视图是具有类型模型的session类型视图。
session