开发者

Controlling Razor views programmatically?

Is is possible to programmatically control Razor views? Can I reach the different RenderSection parts or change the Layout defin开发者_JAVA技巧ition in code?

I'm looking into possibilities to use Razor syntax in the presentation layer of a CMS application. Might Spark be a better choice because of it's (parseable) XML syntax?


Take a look at http://razorengine.codeplex.com and http://tqcblog.com/2011/01/23/precompiled-razor-for-shared-views-and-mono/ - you can convert razor views to c# code and set the views to use a custom base class that has whatever additional functionality you need.

You may also be able do something with the viewstart file - although set up as a razor view, it is effectively custom code that modifies the settings of all views, including the layout.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜