viewengine

How to use MVC Action Results from regular web forms (faking ControllerContext)?

We have a pluggable framework that returns ActionResult objects that render things to a browser. One late breaking requirement is that our plugins should be callable from a regular ASP.NET Web Forms application. So far I have come up with this, which works for very basic ActionResults: public class ActionResultTranslator { HttpCo...

ASP.NET MVC Custom View Engine Not Being Called.

I am attempting to impliment a custom view engine to serve mobile views based on the user agent. I am following Scott Hanselman's approach from this blog post. I have inherited from the WebFormsViewEngine and overridden the FindView method the same way that Scott describes in his blog. I then added a few lines to my Global.asax Applica...

What are the benefits of using an alternate view engine?

I am playing with ASP.NET MVC and I see that there are a few alternate view engines available for it such as NHaml and Spark. My question is why would you use an alternate view engine? I don't see a benefit to having something like this: <ul if="products.Any()"> <li each="var p in products">${p.Name}</li> </ul> <else> <p>No pr...

When is the MasterPageFile located in ASP.NET MVC WebForms ViewEngine

When is the MasterPageFile property of a view/page checked that it exists in ASP.NET MVC WebForms view engine? What I want to do is have the following code not output the error: Parser Error Message: The file '/SomePlaceThatDosentExist/Site.Master' does not exist. Defined as such in my view's .aspx file: <%@ Page Language="C#" Ma...

ASP.NET MVC ViewEngine ViewLocationCache.GetViewLocation returns null

Hi, I am following Chris Pietschmann's solution for theming in ASP.NET MVC. One thing I have noticed is that the view name is not being retrieved from the ViewLocationCache on subsequent requests. I am using ASP.NET MVC 2.0 RC When the following code is executed: this.ViewLocationCache.InsertViewLocation(controllerContext.HttpContext...

ASP.NET MVC: How do I get all available views?

I have a controller on my site that handles unknown actions and returns a view if it exists. This is so that static content can be added to this particular area of the site without having to modify the controller. The problem I am faced with now is to create a sitemap.xml file that contains links to all of these "unknown" views. What ...

Output Cache problem on ViewEngine that use 2 separate view for 1 controller

http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx To the sake of simplicity, please try out this. Basically, I am trying to do the mobile view engine, but then i found out that I have outputcache, which will cache one of 2 view (PC view) and then when i tried to access through mobile, it ...

Mixing spark and webform view engines

Is it possible to use multiple view engines? I have a large(ish) site that is already using the webforms view engine, but we would like to move to spark for new features. Is this supported? any documentation online that details how to do this? ...

Has anyone been able or at least tried to port Liquid Template Language to C#?

I need to give end-users the ability to securely edit an asp.net mvc web application templates and so far Liquid Template Language seems to be perfect, but it is written in Ruby and porting it seems a too complex task for me as I don't know Ruby... anyone tried to port it to C#? It would be really useful in a lot of situations and I'm go...

Spark can't find views

I have the following folder structure in an ASP.NET MVC 2 app using Spark. [site root] home HomeController.cs Views Shared Index.spark However, if I move Index.spark into the /home folder, I get the following error: The view 'Index' or its master was not found. The following locations were searched: ...

Running ASP / ASP.NET markup outside of a web application (perhaps with MVC)

Is there a way to include some aspx/ascx markup in a DLL and use that to generate text dynamically? I really just want to pass a model instance to a view and get the produced html as a string. Similar to what you might do with an XSLT transform, except the transform input is a CLR object rather than an XML document. A second benefit i...

Dynamic Views based on view models

I have an asp.net mvc 2 app. I need to display the same page to each user. But each user has different rights to the data. IE some can see but not edit some data, some cannot edit nor see the data. Ideally data that cannot be seen nor edited is whitespace on the view. For security reasons I want my viewmodels to be sparse as possible. ...

Would you like ASP.NET MVC view engine in which a view is created entirely in Code?

Recently I created a spike of a view engine, in which views are plain classes, and the content is created by using funny using-scope blocks. The code together with a simple sample site is available at http://code.google.com/p/sharp-view-engine/ Here I'd like to hear your opinions regarding such an idea. Is it completely weird or maybe ...

Literals that precede { in spark view engine.

I was going through the spark view engine documentation and found a lot of literals showing up in code for which I couldn’t find any references. For e.g. ! , #, $ , !$ , ... What are these for? What do the combinations mean? When do they come into use? Am I missing any more literals that precede or comes after { ...

Which View Engine are you using with ASP.NET MVC?, and Why?

Hi, I'm thinking of experimenting with alternative View Engines for ASP.NET MVC, and would like to know what other people are using. Please let me know 1) Which View Engine you use, and 2) Why. The standard 'web-forms' view engine is of course a valid answer, but please say so only if you have decided to use it for a reason, not just ...

Custom View Engine in ASP.NET MVC 2 does not work with Areas

I used the code below so far with ASP.NET MVC v1 and v2 but when I added an Area today to my application, the controller for the area couldn't find any views in my Areas/Views/controllerView folder. It issued the very well known exception that it searched those 4 standard folders but it did not look under Areas.. How can I change the co...

Spark VS 2010 intellisense

I was thinking about switching one of my projects (and after that subsequently other projects too) to Spark View Engine but after todays research I ran into problem of a lack of Intellisense for Visual studio 2010. Not only that but it seems that the project is not maintained regularly. So I'm left with a feeling that I should not choos...

ASP.NET MVC Custom Attributes within Custom View Engine

Assuming I write a custom attribute... public class SpecialActionFilterAttribute : System.Web.Mvc.ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { } public override void OnActionExecuting(ActionExecutingContext filterContext) { // set some parameters here. ...

Custom tokens in view engine?

In ASP.NET MVC 2 project, how might I go about writing a custom view engine that allows custom tokens to be used when searching for views? Specifically, I'm trying to achieve this: In PagesController: public ActionResult ViewPage(string folder, string page) { return View(folder, page); } I want the view engine to search for the vi...

installing the razor view engine for Visual Studio

I just downloaded and installed Web Matrix beta. I am really liking the razor view engine. Not so much the Web Matrix IDE. Is there any way to install razor view engine for use in the Visual Studio without installing WebMatrix? ...