viewengine

erb <% expression -%> in aspx pages

Do asp.net aspx views have tags that that work similar to the Ruby erb <% -%> ? I don't like all these line breaks in my asp.net mvc generated html. As for the other view engines (nhaml, spark, razor) I don't want to use them yet. Quick example of the difference between <% %> and <% -%> in erb: 1. <% %> <% 3.times do %> Ho!<br /> <% e...

Custom View Engine vs Custom Action Result

Hey! 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 to do this and basically came across both Custom View Engine, and Custom Action Resu...

Use ASP.NET MVC as Email Template Engine: Good Idea?

Hi, Would it be a good idea, and executable, to use the ASP.NET MVC View Engine to render html to be sent out by email? I know it's possible to let the view render into a string. So that could be use to build the mail message. Since ASP.NET MVC is already used in the application, I get to use all practical ASP.NET MVC stuff without hav...

Where can I find some quality tutorials that take me through the anatomy of an MVC view?

My background is mostly in desktop applications on the Microsoft platform. I've been working a lot with ASP.Net MVC lately and completely skipped over learning webforms. I find I'm having the most trouble (not being a web guy) with writing my views in MVC. How proficient should I be with HTML and javascript to write good views in MVC?...

How do I set a custom view engine from within the controller?

I'd like to set a custom view engine from within a controller that is specific to that controller. Or is there some configuration-based way to tell the framework to use the custom view engine only for that specific controller? ...

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. <ul> @foreach (var mi in Model.MenuItems) { <li@(mi.Selected?" class=\"selected\"":null)> @if (string.IsNullOrEmpty(mi.Title)) { <a href="@mi....

asp.net mvc 2: set master page in WebFormViewEngine's FindView

Hey guys I got a problem with a custom ViewEngine. I try to overrite the FindView method to set the master view without having to define it in each and every view page. public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) { if (string.IsNullOrEmpty(masterN...

Creating ASP.NET MVC style views in a console application?

I have a console application that requires me to send out e-mails. Right now I use a string builder to create the e-mails, but I'd like to get more fancy. Then it dawned on me: it would be nice to send my object to an ASP.NET MVC style view, where I'd have the HTML markup, and then return it to mail out. Right now, I have it going as; ...

Need some advise on starting a New Life with MVC 2 and which Tools to use for RAD in MVC2 ?

Dear All I have finally decided to hop up on the train of MVC 2. Now i have doing alot of reading lately and following is the architecture, which i think will be good enough for most of Business Web Application. Layered Architecture:- Model (layer which communicates with Database). EF4 Repository (Layer which communicates with Model a...