I've written a custom html helper in MVC 3 that receive as a 开发者_开发知识库parameter the model my view is based on. What I'm wondering is: can a custom helper access the model without receiving it as a parameter? Is there any way to avoid calling it like this: @html.MyCustomHelper(Model)?
you can use the ViewData property of HtmlHelper to access the model
helper.ViewData.Model
精彩评论