Questions tagged [asp.net-mvc-templates]

Topics related to creating and customizing and styling Asp.net MVC view Engine to represent better user interface and experiment.

21 questions
45
votes
3 answers

MVC template from folder other than default (EditorTemplates/DisplayTemplates)?

Can you point MVC to a folder other than the default ones (Views/Shared/EditorTemplates & Views/Shared/DisplayTemplates)? I'd like to either put them in subfolders below those, or in other folders outside the Shared folder. For example, if I have…
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
23
votes
2 answers

ASP.NET MVC 3 Razor Templates VS RenderPartial

I just read this blog post on Razor Templating in ASP.NET MVC 3. Put simply, i just dont get it! That is, i don't see why we need this (fairly) complicated code to achieve what can be done IMO easier (and neater) with @RenderPartial ? Here's what i…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
10
votes
4 answers

Adding HtmlAttributes to template

If I am passing HtmlAttributes into a template, like this: @Html.DisplayFor(m => m.FirstName, new { htmlAttributes = new { @class = "orangetxt strongtxt" } }) In my template, how would I inject these into my HTML:
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
9
votes
2 answers

Formatting currency using display template in MVC

I found this post about Display and EditorTemplates for MVC: http://www.growingwiththeweb.com/2012/12/aspnet-mvc-display-and-editor-templates.html It creates a display template to easily display a decimal formatted with currency sign. The model used…
7
votes
1 answer

Editing and saving complex objects

Say you have the following object: public class Address { public String Line1 { get; set; } public String Line2 { get; set; } public String City { get; set; } public String State { get; set; } public String ZipCode { get; set; } public…
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
6
votes
1 answer

partial view coming without validation attributes (ASP.NET MVC 3)

A weird thing keeps happening on one of my ASP.NET MVC 3 apps. I am fetching insert rows via jQuery Ajax api and there is no problem with that. But when I get the necessary partial view back, it is coming without validation attributes and I am…
4
votes
1 answer

RenderPartial() in T4 Template

I am wondering if its possible to take an existing partial view's logic and reuse it for dynamic email generation, within a preprocessor template? When looking through the T4ToolKit's intellisense options for <#@ import namespace="System.Web.Mvc"…
James Grim
  • 41
  • 1
3
votes
1 answer

Reach out to ModelMetadata of one of model property

I was reading one of Brad Wilson's articles: ASP.NET MVC 2 Templates, Part 2: ModelMetadata http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-2-modelmetadata.html Let's assume that on my ASP.NET MVC 3 App, I have the following…
tugberk
  • 57,477
  • 67
  • 243
  • 335
3
votes
3 answers

Is there any way to re-use editor & display templates in asp mvc applications?

We're developing 3 asp mvc applications, all will require some of the same shared editor & display template views. Rather than copy/paste these across all 3 projects, is it possible somehow to put them in a shared component and reference them…
Jeremy
  • 44,950
  • 68
  • 206
  • 332
2
votes
5 answers

How to produce non-sequential prefix collection indices with MVC HTML Editor templates?

The following code has been stripped down a lot, but basically what I'm looking to achieve is as follows: I'd like to able to edit Questions and their containing Answer Choices, while being able to dynamically add/remove Questions/Answer Choices…
bfir3
  • 19
  • 1
  • 3
2
votes
1 answer

ASP MVC standard views

ASP MVC scaffolding creates Index, Create, Update, Delete views, but how practical is that in reality. There seems to be a lot of duplication of UI code with the Create, Update and Delete views. Would it not be more practical to have one view for…
Lee
  • 8,354
  • 14
  • 55
  • 90
1
vote
1 answer

How do I put a strongly-typed-view WebForms .aspx template in a nonstandard location in ASP.NET MVC2?

So, I personally think this is sort of whack. I put a .aspx template in a nonstandard location. In this example, it has a virtual path of ~/Content/Sites/magical/Index.aspx. I then created my own view engine as a test, which extends…
1
vote
0 answers

Visual Studio 2015 CTP has no MVC option when targeting 4.0

Using VS 2015 CTP, I'm trying to create a web application that targets fx 4.0 There is no MVC 4 Web Application template in the options. That template does exist in VS 2013 Update 4. Did I miss something in the install of VS 2015?
eych
  • 1,262
  • 2
  • 16
  • 37
1
vote
0 answers

Is there an "extended" UIHint attribute to apply CSS styles for DisplayFor - EditorFor templates?

Intro: After reading Brad Wilson Metadata series and searching unsuccesfully on google, I was wondering: Question: Has any OS project / code been created that allows you to tag CSS styles in the Meta information, for example in my (buddy) Model, I…
AJ.
  • 621
  • 4
  • 8
0
votes
2 answers

C# F# MVC 3 template deployment

I've recently started to explore Daniel Mohl "F# C# ASP.NET MVC3" template. Can anyone share on how this type of project should be deployed to IIS7?? Thanks.
B.K
  • 1
1
2