Questions tagged [viewengine]

262 questions
342
votes
6 answers

ASP.NET MVC View Engine Comparison

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 view engine is. I'm not necessarily looking for "best" or "fastest"…
mckamey
  • 17,359
  • 16
  • 83
  • 116
81
votes
4 answers

Razor Nested Layouts with Cascading Sections

I have an MVC3 site using Razor as its view engine. I want my site to be skinnable. Most of the possible skins are similar enough that they can derive from a shared master layout. Therefore, I am considering this design: However, I would like to…
Chris Nielsen
  • 14,731
  • 7
  • 48
  • 54
57
votes
11 answers

What is view engine? What does it actually do?

I started learning ASP.NET MVC3. So, while reading tutorials online and in books, I came across this term "view engine" quite frequently. I don't know what it is. What does it actually do? Why should it matter to me at all?
Nawaz
  • 353,942
  • 115
  • 666
  • 851
56
votes
15 answers

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…
serg10
  • 31,923
  • 16
  • 73
  • 94
43
votes
8 answers

How to concisely create optional HTML attributes with razor view engine?

I'm looking for a way to write the following code with less lines of code (maybe 5). I suppose I could do the same thing as the selected class but this razor syntax isn't looking pretty.
    @foreach (var mi in Model.MenuItems) { …
JarrettV
  • 18,845
  • 14
  • 46
  • 43
41
votes
6 answers

ASP.NET MVC Razor view engine

After reading Scott Guthrie's blog entry about the new Razor view engine for ASP.NET MVC and reading this question comparing the available view engines. Razor seems to address most of the problems with the default view engine. What feature…
Nicholas Murray
  • 13,305
  • 14
  • 65
  • 84
36
votes
5 answers

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 WebFormViewEngine something what is custom IDescriptorFilter in Spark. Is…
Jakub Šturc
  • 35,201
  • 25
  • 90
  • 110
36
votes
1 answer

How do you declare a comment using the Razor view engine?

Using ASP.NET MVC's default view engine, you can declare a server-side comment like this: <%-- This is a comment --%> This comment will only be visible on the server side and is not sent to the client. How would I do the same with the Razor view…
Daniel T.
  • 37,212
  • 36
  • 139
  • 206
35
votes
2 answers

HTML Encoding Strings - ASP.NET Web Forms VS Razor View Engine

I'm not quite sure how this works yet... trying to find documentation. In my existing app I've got two different ways of rendering strings in my View <%: model.something %> <%= model.something %> The first one is html encoded, and the…
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
30
votes
4 answers

Is there any way to use multiple view engines with Express + Node.js

Scenario: I had developed some transactional pages using Node.js, Express + Handlebars as view engine and MongoDB. Now the issue is during module integration I got some of the pages which are built on Express + Jade as view engine. Question: How to…
Amol M Kulkarni
  • 21,143
  • 34
  • 120
  • 164
20
votes
3 answers

Is there a jade template engine for ASP.NET MVC?

I've always been searching for a best suitable ViewEngine for me in ASP.NET MVC, and after observing a ton of template engines in either JAVA, PHP, Python, Ruby, NodeJS... I found the jade template and loved it since it has some really nice…
otakustay
  • 11,817
  • 4
  • 39
  • 43
18
votes
6 answers

Partials with Node.js + Express + Hogan.js

I'm developing a site with Node.js + Express and using as view engine Hogan.js. This is my file app.js: /** * Module dependencies. */ var express = require('express') , routes = require('./routes') , user = require('./routes/user') , http =…
user1288707
17
votes
2 answers

Why do we use HTML helper in ASP.NET MVC?

Are there any good thing, best practice or profit we have after using the HTML helper in an ASP.NET MVC project? When I am trying to use them I found that I lose the speed I have with HTML and many difficulties I have whenever I use an HTML…
Steven Spielberg
16
votes
2 answers

Default Content for Section in Razor

I want to have some default content for a section let suppose Footer. How can I do this. Also, what if I want to render a partial view as the default content. Thanks
Shakeeb Ahmed
  • 1,778
  • 1
  • 21
  • 37
15
votes
2 answers

What is an ASP.Net MVC View Engine?

There are quite a lot of questions on SO regarding View Engines in ASP.Net MVC, and about using "custom" ones instead of the "default" one. For me as a hobby programmer, the term "View Engine" is new, and I have not been able to understand what it…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
1
2 3
17 18