开发者

Is there an ASP MVC Equivalent for PHP's require_once()?

I'm wondering if there is an ASP.Net MVC equivalent to PHP's require_once() function.

Lets say I need to call RenderAction to a particular action twice. However, inside the view that is rendered from said action, I need to print out some init scripts but only once.

Is ther开发者_运维技巧e an easy mechanism to do this? Should a flag be set in the controller and then passed into the view?

Thanks for any help you can provide.

Edit Thanks for the responses. I know I can do this through the controller or temp data or some mechanism like that but wasn't sure if there was anything built into .NET MVC that would have done this for me automatically.


I am not aware of such equivalent.

Should a flag be set in the controller and then passed into the view?

That seems like a good way. The flag needs to be passed as argument to the controller action when using the RenderAction helper.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜