viewengine

C# ASP.NET - how to use the default view engine standalone ?

I would like to be able to use an ASP.NET view as an email template, complete with the <%= "hi there" %> syntax. Is there a way to invoke/setup this view engine in a standalone way? ...

Can you recommend a .net template engine?

I am looking for a .net templating engine - something simple, lightweight, stable with not too many dependencies. All I need it for at the moment is creating templated plain text and html emails. Can anyone give me a good recommendation? If it helps at all - something like Java's Freemarker or Velocity libraries. [UPDATE] Thanks for ...

Implement ASP.NET MVC View Engine for pre-processing

I would like to implement a ASP.NET MVC View Engine to perform some pre-processing of the original .aspx/.ascx. file. Then, I want to pass the result to the default view engine (typically the WebForm View Engine). This means, the default View Engine shouldn't read this file from disk, since this is not yet processed. Instead, i would wa...

How to make a structure map powered viewengine in asp.net mvc

My views extend a base view class ive made: public class BaseView : ViewPage At the moment im calling ObjectFactory.GetInstance inside this class' constructor to get some interface implementations but id like to use structuremap to inject them as constructor arguments. Im using a structuremapcontrollerfactory to create my controllers...

Calling another controller action after the current controller action has finished executing

What I am trying to achieve: After each view has finished executing I would like to make a separate http call to an external partner. I need to pass one of the view's content as body of that http call. What I have so far: I have a base controller from which all of my controllers inherit from. I have found that i can override the ...

Extending WebFormView in MVC

Howdy, I want to extend the WebFormViewEngine so that I can perform some post-processing - I want it to do it's stuff, then hand me the Html back, so I can do put some final touches to it. It needs to be done as a View/ViewEngine because I need access to the ViewData. Unfortunately there seems to be no way to get the Html back from th...

MasterLocationFormats in WebFormViewEngine not used?

I tried to make the ViewEngine use an additional path using: base.MasterLocationFormats = new string[] { "~/Views/AddedMaster.Master" }; in the constructor of the ViewEngine. It works well for aspx and ascx(PartialViewLocationFormats, ViewLocationFormats). I still have to supply the MasterPage in web.config or in the page declara...

alternative asp.net MVC view engines

I was wondering if there was a general consensus on the "best" alternative view engine for asp.net MVC. So far I know of Spark, Brail, NHaml but what about others? ...

use view only as template

Hi all, I am struggling with WiewUserControls. What I want to accomplish is View without knowledge of which usercontrol have to call with RenderPartial in order to render some html. What I want instead is to give some kind of IViewEngine interface and then View can only call on certain place in template methods of IViewEngine that will...

Writing a TemplateLanguage/VewEngine

Aside from getting any real work done, I have an itch. My itch is to write a view engine that closely mimics a template system from another language (Template Toolkit/Perl). This is one of those if I had time/do it to learn something new kind of projects. I've spent time looking at CoCo/R and ANTLR, and honestly, it makes my brain hurt,...

Find the atrributes on an action from the ViewEngine in ASP.NET MVC

I've got a custom ViewEngine and I want to modify the master page used depending on if the requested action has an Authorize attribute filter. So far I'm just using reflection like this: var method = controllerContext.Controller.GetType().GetMethod(viewName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); if (me...

How to change default view location scheme in ASP.NET MVC?

I want to change view locations at runtime based on current UI culture. How can I achieve this with default Web Form view engine? Basically I want to know how implement with WebFromViewEngine something what is custom IDescriptorFilter in Spark. Is there other view engine which gives me runtime control over view locations? Edit: My U...

ASP.NET (MVC) - render page to a file

Hello, I have to create a bunch of static html files as console / winform job. The current solution uses a string builder. Having used ASP.NET-MVC with strongly typed view pages (System.Web.Mvc.ViewPage) I was wondering if it is possible to leverage these view pages and have them output to a stream or file without building an ASP.NET ...

MasterPage/ContentPage with NVelocity and ASP.NET MVC?

I am a big fan of NVelocity. I think its terse syntax is a huge boon, and helps keep my views simple and effective. I have begun using the NVelocity view engine from the Mvc Contrib project for ASP.NET MVC, along with the Castle NVelocity .vm syntax highlighter. While I love what NVelocity brings to the table, I am really missing one f...

What are the benefits of using an alternate ASP.NET MVC view engine?

I have looked at the usual suspects...Spark, NHaml, etc. They all seem to be syntactic sugar for those that are uncomfortable with the <% %> syntax. Are there any other tangible benefits? Syntactic sugar doesn't seem to me to be a sufficient reason to change out the entire view engine. Reasons posted so far: Easier to transition fr...

What is the most usual way to develop views in asp.net mvc?

What is the most usual way to develop views in asp.net mvc? Should I be using a view engine other than the default? As far as I know, StackOverflow is the bigger site using ASP.NET MVC, so, what they use? In the pros of using view engines, it seems like they are easier than the default. In the cons, it seems that they break the original...

How to group partial shared views for specified controllers?

Is it possible to tell ViewEngine to look for partial shared views in additional folders for specified controllers (while NOT for others)? I'm using WebFormViewEngine. This is how my PartialViewLocations looks at the moment. public class ViewEngine : WebFormViewEngine { public ViewEngine() { PartialV...

ASP.NET MVC View Engine Comparison

EDIT: added a community wiki answer to begin capturing people's experience with various View Engines. Please respectfully add any experiences you've had. I've been searching on SO & Google for a breakdown of the various View Engines available for ASP.NET MVC, but haven't found much more than simple high-level descriptions of what a vi...

Is it possible with ASP.NET MVC to render a view from a template pulled from a database?

What I'm trying to do is generate email content using different templates. I think ASP.NET MVC could be a good fit for this. My controller would get the necessary data for the email and decide which view (template) to render. (It's more that just a simple mail-merge, there would need to be conditional blocks, foreach's, etc.) I wan...

Where has ViewEngines.DefaultEngine gone an asp.net MVC?

I was recently trying to get the default view engine in ASP.NET MVC 1.0 and couldn't seem to access the ViewEngines.DefaultEngine property that used to be available in the CTP and Beta versions. Does anyone know what the equivalent in the 1.0 release is? ...