开发者

MS MVC 3 custom html helper that recieve as parameter the model?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜