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.
基本的に、テンプレートの「ウィンドウ」コンテナーとして機能するレイアウト ページを参照するページがあります。私が知りたいのはViewBag、内部ページからレイアウト ページに情報を渡すための最良の (非) メソッドは何ですか?
ViewBag
テンプレートをビュー モデルにバインドします。ベース ビュー モデル (親用) を用意し、子ビュー モデルが親ビュー モデルを実装することをお勧めします。
public class ParentViewModel { public string SomeSharedField { get; set; } } public class ChildViewModel : ParentViewModel { public string SomeFieldJustForChild { get; set; } }