Questions tagged [viewengine]
262 questions
2
votes
1 answer
In asp.net mvc, how do I switch the masterpage from the view?
I have been reading this link from Steven Sanderson about mobile web development http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application, and I am trying to execute his razor code in aspx.
Razor code from…

quakkels
- 11,676
- 24
- 92
- 149
2
votes
1 answer
How can I load external layout files using RazorEngine?
I've been trying for days (really, days) to use "external" files (provided from a different server using an ashx handler) as layouts in Razor.
@{
Layout = "http://someServer/templates.ashx?path=/my/template.cshtml";
}
This gives me an error…

Dänu
- 5,791
- 9
- 43
- 56
2
votes
1 answer
Trying to use FindView with a path
I'm trying to check if a couple of views exist by using paths. But the views cannot be found even if they do exist.
private string SelectFirstView(ControllerContext ctx, params string[] viewNames)
{
return viewNames.First(view =>…

jgauffin
- 99,844
- 45
- 235
- 372
2
votes
1 answer
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…

baretta
- 7,385
- 1
- 25
- 25
2
votes
1 answer
Erratic requests arising from client when using a custom view engine in ASP.Net MVC
I have spent about 7 hours trying to figure this out but gotten nowhere.
This is how my fiddler trace looks like
I have two routes that look like below that are registered for this page.
[route name="DummyResultsWithMarketStateNames"…

Praveen
- 772
- 2
- 9
- 25
2
votes
1 answer
Inject selected view path as HTML comment to start and end of action's output
I'm currently putting together a multi-tenancy web app using MVC 3. At least 30 different Web sites will share a common codebase, and while also sharing similar under-the-hood functionality, they are need to look significantly different. As a…

Steve Owen
- 2,022
- 1
- 20
- 30
2
votes
2 answers
ASP.NET MVC2 Custom View Engine ignored in unit tests
I'm trying to unit test a controller that stuffs data into a ViewData. All our views require similar data (Customer info which is derived from the url). So instead of putting the call into every single controller method, the original developers…

Code Silverback
- 3,204
- 5
- 32
- 39
2
votes
2 answers
The type initializer for 'System.Web.Mvc.ViewEngines' threw an exception
I am trying to unit test a void method that have controllercontext parameter and some more to send email. Email template render partial view using view engine. I mocked controllercontext. So render view throw an exception because ControllerContext…

Rajadurai Azhagudurai
- 73
- 2
- 14
2
votes
2 answers
ExpressJs doesn't cache views in production mode
I have a problem with ExpressJs not caching my views when NODE_ENV is set to production. I'm using the EJS template engine. Here is my code:
npm script
"start": "set NODE_ENV=production && node ./bin/www"
app.js
console.log(app.get('env')) => logs…

Tarabass
- 3,132
- 2
- 17
- 35
2
votes
1 answer
Working with subfolders in custom view engine
In a bid to keep my views organised within my new MVC 5 application, I've set up a folder structure as follows:
Views
|-- Account
| |-- Partials
| |-- EditUser.cshtml
| |-- ListUsers.cshtml
| |-- Home.cshtml
|
|-- Admin
|--…

Dave
- 1,076
- 5
- 15
- 30
2
votes
1 answer
Custom View Engine vs Custom Action Result
I have a scenario where the user have the option to click the button "download" and I should create a csv file, that contains history data, and then let the user save the file locally. As I haven't done this before, I started to look around for how…

MrW
- 1,210
- 2
- 16
- 27
2
votes
1 answer
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…

Ciel
- 17,312
- 21
- 104
- 199
2
votes
2 answers
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…

amartynov
- 4,125
- 2
- 31
- 35
2
votes
3 answers
MVC 5 Custom ViewEngine to Load External Controllers and Views
REQUIREMENT
I have a project and one of requirements is load external small websites like plugins.
This websites must accomplish few requirements of course (like mvc and net version and other more to make it compatible).
This plugins must be…

David Peláez
- 23
- 1
- 4
2
votes
1 answer
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,…

Frank Schwieterman
- 24,142
- 15
- 92
- 130