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
2 answers

Accessing a view model element through Javascript

I am passing a Model to my view that is called HomeViewModel. The HomeViewModel has a bool property called isNext. In my view, I simply want to display the isNext value. So basically I have this: @model Impoware.Models.HomeViewModel @{ …
houman_ag
  • 227
  • 3
  • 14
0
votes
0 answers

asp.net mvc 5 one model with different format in view

I'm a newbie in MVC. Sorry all professionals for this question. I have a model like: public class Student { public int ID { get; set; } public int Number{ get; set; } public string Name{ get; set; } public string Surname{ get; set;…
AhuraMazda
  • 460
  • 4
  • 22
0
votes
2 answers

How to localize structures HTML views in ASP.NET?

I have a multi-language website and views content (including the markup) can differ from language to language. That's why I cannot just localize strings and put them into resources. For example, my view in Russian:
Yeldar Kurmangaliyev
  • 33,467
  • 12
  • 59
  • 101
0
votes
1 answer

Bind a list with nested list

Model public class PdfPage { public IEnumerable Photos { get; set; } } public class PdfPhoto { public string path { get; set; } } View
  • <%= Html.Hidden("ListPages[0].Photos[0].path", "/public/pdfMaker/4_e.jpg")%> …
Sig. Tolleranza
  • 499
  • 9
  • 27
0
votes
1 answer

how to save text in app_resource. asp net mvc c# metatags

I have all my text inside view coding. I preffer to save it in app_resources, because i would to add other languages in future, and its look quite cleaner. I just know that I need to use metatags in my view for text to connect it with file…
r.r
  • 7,023
  • 28
  • 87
  • 129
0
votes
1 answer

paging with asp.net mvc c#

Hello its my code where I giving out paging of view:
<%= Html.RouteLink("<<", new { page = 1 }, new { title = "first page" })%> <% if (this.Model.HasPreviousPage) {%> <%=…
r.r
  • 7,023
  • 28
  • 87
  • 129
0
votes
0 answers

How can I encode some input in a view when the view is posted?

I am coding a C# MVC 5 internet application where a user enters XML input into a textbox in a view. How can I encode this XML input as JSON when the view is posted? Here is an example of the input:
@Html.LabelFor(model…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

using the same partial view with different buttons

I have the following partial view, which lists users in a table. Each row has an Enroll button, which enrolls the user to the selected course. I need almost the same view for another task. However, I need to add users to Discussions (instead of…
renakre
  • 8,001
  • 5
  • 46
  • 99
0
votes
1 answer

How to get data back from partial view

I have a partial view (using MVC2 .net) inside a view which is a form. the partial view has a textbox and is strongly typed. The problem is I can't get the textbox data from the partial view when I post back, for some reason I can get all the view…
0
votes
1 answer

MVC View columns do not start at same height

Using MVC 5 and bootstrap. I have a view that has two rows. The top row has two columns. Why is it that when the page is done the right column appears to be starting a little lower then the left one? Also, the second row(bottom) is not as wide as…
George
  • 33
  • 7
0
votes
1 answer

Edit view - search form

I have some basic CRUD views for a model: public class Task { public Task() { this.Users = new List(); } public string Id { get; set; } public string Name { get; set; } public DateTime DueDate { get; set;…
user2818430
  • 5,853
  • 21
  • 82
  • 148
0
votes
1 answer

MVC View change specified row bgcolor

In my MVC view, I am displaying list of data from my model in a table as shown below. How to make a specified row to change color when one of the field satisfy certain condition within my if-else statement? It does not seems like I can add a jquery…
Z.V
  • 1,441
  • 3
  • 21
  • 35
0
votes
1 answer

Is it possible to append html to a class or div using razor syntax

I am coding a MVC 5 internet application and have a question in regards to accesssing html classes or divs via razor syntax. Is it possible to access a html class or div via razor syntax and append some html code to the class or div? Is there a html…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
4 answers

How do I pass multiple objects from a ViewModel to a jQuery function?

I am coding a MVC 5 internet application and would like to know how to pass values from a ViewModel into a jQuery function where I have a list of data to pass. Usually, I would create a hidden field in the MVC View code, and then retrieve this value…
Simon
  • 7,991
  • 21
  • 83
  • 163
0
votes
1 answer

How to add data to a 2D array in MVC view using HTML helper

I am coding a MVC 5 View, and would like to know how to add data to a hidden 2D array. Here is my code: @Html.Hidden("hdnArray") @for (int i = 0; i < 2; i++) { string[] items = new string[4] { "1", "2", "3", "4" }; @Html.HiddenFor(items, {…
Simon
  • 7,991
  • 21
  • 83
  • 163