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.
私は mvc 4 を使用しており、カスタム HtmlHelper を作成しました。
そのヘルパー内から、ヘルパーを呼び出しているビューにアクセスすることは可能ですか? ヘルパー メソッド内のベース ビューにあるプロパティを使用したいと考えています。
はい、できます:)
public static void MyExtension(this HtmlHelper html) { var view = html.ViewDataContainer; // accessing view properties var viewModel = view.Model; var viewAjax = view.Ajax; // etc }