Questions tagged [asp.net-mvc-views]

A view is a standard (X)HTML document that can contain scripts. You use scripts to add dynamic content to a view.

To make it easier to add content to a view, you can take advantage of something called an HTML Helper. An HTML Helper, typically, is a method that generates a string. You can use HTML Helpers to generate standard HTML elements such as textboxes, links, dropdown lists, and list boxes.

167 questions
1
vote
1 answer

MVC extension unrecognized

I am building a side menu page wuth the following code
1
vote
2 answers

MVC 5 Error page not showing

I am coding a MVC 5 internet application and am having a problem with errors. When entering in some invalid View data, I am getting an error related to the error page being shown. I am entering the following: test In my Global.asax…
Simon
  • 7,991
  • 21
  • 83
  • 163
1
vote
2 answers

how to save a mvc view as a file and print the same file?

In my controller, I am rendering a view. My Action method looks like this: public ActionResult SomePrint(Model model) { //Some business action return View("viewname",model); } Now my requirement is to save this view as file(may be pdf file)…
Santosh
  • 2,355
  • 10
  • 41
  • 64
1
vote
1 answer

MVC 5 - Pass object to a shared view

I am developing a MVC 5 internet application and have a question in regards to passing an object to a shared view. I have a view called CustomError.cshtml in the shared folder. This view has the following model type: @model…
1
vote
0 answers

MVC validation depending on form element

I am coding a MVC 5 internet application and have a question regarding validation in a view. Here is my view code:
@Html.LabelFor(model => model.asset.linkFromExternalResource, htmlAttributes: new { @class =…
Simon
  • 7,991
  • 21
  • 83
  • 163
1
vote
1 answer

MVC View (Dont want to reapeat the Id's)

I have a WCF service and and we had to generate a records of clients who have consumed free credit. I have generated that records but now clients with same login ID's are repeating in the records. I dnt want to display the login ID again but want to…
1
vote
1 answer

can i have dynamic model for mvc view

I am developing a Create form in a .Net MVC project. I will create a simple demo for the question as close as i can have for my real business scenario. I have a person class and few other classes which inherited from it. public class Person { …
Laurence
  • 7,633
  • 21
  • 78
  • 129
1
vote
1 answer

ASP.NET MVC: How to reference the MVC Area root in View script paths?

I've got an ASP.NET MVC 4 application with a few sub-Areas. Ideally I'd like each Area to be as self-contained as possible, including all Content, Images, and so forth. Is it possible to override the behavior of the "~" (tilde) character in resource…
Brian Lacy
  • 18,785
  • 10
  • 55
  • 73
1
vote
4 answers

Where to store string constants in my ASP.NET MVC app?

Specifically, I have a phone number that is used in a bunch of views(and a couple actions), and I would like to centralize that somewhere in case it changes. Is web.config good enough? Is there a better place for this? Ideally, I wouldn't have to…
Evan
  • 836
  • 1
  • 13
  • 25
1
vote
1 answer

Insert view with collection property

I have a Person class and a Contact class. A person can have many contacts. public class Person { [Required] public string FirstName { get; set; } public string LastName { get; set; } public string Notes { get; set; } …
Amro
  • 1,369
  • 2
  • 10
  • 16
1
vote
2 answers

MVC4 View Multiple Submit Buttons - Update label text

At the moment I am working on a MVC4 view with multiple submit buttons. To handle the submit of the different buttons, I use this class: http://blog.maartenballiauw.be/post/2009/11/26/Supporting-multiple-submit-buttons-on-an-ASPNET-MVC-view.aspx I…
Odrai
  • 2,163
  • 2
  • 31
  • 62
1
vote
1 answer

Create N*M in view by iterating through model items
Well, easily I have a model: @model IEnumerable And it's quite straightforward to iterating through its items and create a One-item-per-row table to show them. And the problem is that I want to create a table like…
Amin Saqi
  • 18,549
  • 7
  • 50
  • 70
1
vote
1 answer

Other ways of MVC 3 Asp.net testing

I am currently testing MVC 3 Controller and views using HTML and notepad. Is there other ways to do testing if you cannot modify the code? Like for example creating a seperate project to do testing?
1
vote
1 answer

Is there a way to invalidate the ASP.NET MVC 3 ActionCache

I have an ASP.NET MVC 3 application that uses custom attributes to create select controls for model properties that can be populated from external data sources at runtime. The issue is that my EditorTemplate output appear to be cached at the…
Lucas
  • 8,035
  • 2
  • 32
  • 45
1
vote
3 answers

How can you create a label from one table and store the value in another with ASP.NET MVC

I have a table called Field in my database and a table called FieldValue. My models look like this: [Table("Field")] public class Field { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int FieldId { get;…
Pittfall
  • 2,751
  • 6
  • 32
  • 61