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
0
votes
1 answer

Best to load View or PartialView into the big main Content area?

I have a menu that loads PartialView's into Content area. I load PartialView's because I only want the Content area to change. The pros is the selected menuitem is always highlighted and things like collapsed doesn't change either. One of my…
0
votes
0 answers

return view from different controller.wrong url. asp mvc

I am currently in the shared controller after a post from the client. now, i want to return a view from the Technician controller i tried: return View("../Technician/OrderDetails", model); and its working... but the url stays the same and does not…
0
votes
2 answers

Get a value set via Javascript in a HTTP Post function

I am coding a MVC5 internet application and would like to know how to set a value in Javascript in a View that can be retrieved in the View's HTTP Post method. I have tried this View code:
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

MVC 5 Cannot get another view to load

I cannot get another view to load after initial load of my MVC project. I am using an ajax call to run a method called SlideLayoutView within a controller called SlideView. Here is the ajax call: $.ajax({ url:…
0
votes
1 answer

How Can We bound the Selected Data From DropDownList With textbox in MVC View?

I need to put value in textbox when i select the dropDownlist item.... If there is way to do so.... Regards
@Html.LabelFor(model => model.GenreType, new { @class = "control-label col-md-2" })
Suhail Mumtaz Awan
  • 3,295
  • 8
  • 43
  • 77
0
votes
1 answer

MVC 5 View - Run code every 1 second

I am coding a MVC 5 internet application, and would like to know how to perform a calculation in a view every second. Here is my view code: var expires = Model.account.subscriptionEndDate - DateTime.UtcNow; How can I calculate the expires value…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
2 answers

HTML elements are not the same width

I am coding a MVC 5 view, and have a question in regards to the width of two view elements. Here is a picture of the view: Here is my code:
@Html.LabelFor(model => model.width, htmlAttributes: new { @class =…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

Why is HTTP post request is made on spinner button click

I am coding a MVC 5 internet application and have a question in regards to a view. I have added a Bootstrap 3 input-spinner to my view and the code is at this resource link: http://codepen.io/Thomas-Lebeau/pen/csHqx Here is my view code:
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

MVC 5 integer validation when entering a non integer

I am coding a MVC 5 internet application, and have a question in regards to validating a integer value in a view. I have a model with the following variable: public int integerValue { get; set; } If I enter a string value in the view for this…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

Using a HtmlHelper in MVC 5

I am coding an MVC 5 internet application, and I wish to display the Id of a div when using the DisplayFor method in a view. Here is some code that I have: public static MvcHtmlString DisplayWithIdFor(this HtmlHelper helper,…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

MVC view exception occurs only when modelstate is not valid

I am coding a MVC 5 internet application and an error is being reported when my model does not validate. This is error is in my create view as follows: An exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll but…
0
votes
0 answers

Passing an object from a View to an ActionResult

I am coding a MVC5 internet application and I am trying to pass an object from a View to a ActionResult. The parameter of the ActionResult is an AssetItem called assetItem. Here is the function definition: public ActionResult…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
2 answers

MVC 5 dropdown list for selecting an item

I am coding an MVC5 internet application, and am getting an error when trying to display a dropdown list for a model attribute that is populated from a ViewModel. Here is my Create ActionResult: List blobs = new…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

Need Help on a custom HTML Helper

I'm trying to create a custom HTML Helper to help simplify my masterpages menu, however it is not rendering on the HTML when I use it.. I'm thinking I will need to create a partial view, any ideas? I did this.. public static string…
jaekie
  • 2,283
  • 4
  • 30
  • 52
0
votes
0 answers

MVC - sharing root views with areas

So I have some simple views (Lists, Create/Edit) in my project 'root' and I want to use most of the same view in an admin area(real MVC area). The admin view will only have a few differences. So my two main thoughts are: Create a partial for all…
Evan
  • 836
  • 1
  • 13
  • 25