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

@Html.DisplayName is not displaying EmailAddress Properly

I am trying to display like this var value = "Kartheek@gmail.com" @Html.DisplayName(value) Result is : com only. why? what have to use in this case here i am explaining more My intention is to display content in very generic with grid. public…
0
votes
1 answer

How to call auto click event in MVC view?

I have MVC application. There is one view which contains some properties and the comment link. when user click on comment link, comment div get expands and all comment are shown to user. now I want to automate that function or I can say want to…
Nil
  • 133
  • 2
  • 7
  • 23
0
votes
5 answers

MVC 4 routing / controller logic - something basic going wrong

I had this working yesterday and why it has stopped working is completely beyond me. I have the following, basic scenario: There are two types of roles in my application, Tenant and Landlord. When a Tenant logs in they should be directed to the…
MattSull
  • 5,514
  • 5
  • 46
  • 68
0
votes
2 answers

How can you do multiple saves of a model in one submit?

I have a model: public class CustomerAttributes { public Int Id { get; set; } public string value { get; set; } } my create view looks like this:
@Html.Label("Name")
0
votes
1 answer

Implement a common function in multiple Razor views

In a View, I have a Razor code like @Code Dim x As String = "MyTest" End Code However, how can I share that code with other Views without copy/paste it in all the Views?
Max
  • 4,965
  • 17
  • 49
  • 64
0
votes
1 answer

View action link is not passing values to controller actions

I have the following view:

Contract

@Using Html.BeginForm() @Html.ValidationSummary(False) @
Hire Contract
@Html.LabelFor(Function(model) model.ContractNo)
user1477660
  • 35
  • 1
  • 6
0
votes
1 answer

Change Selected = true in SelectedListItem in ASP.NET MVC3 View by condition

This is my Model: public class MyModel{ public string Name { get; set; } public string listType { get; set; } public string SelectedItem { get; set; } } I have a partial view: @model List @{ SelectListItem iEqualTo = new SelectListItem…
Saeid
  • 13,224
  • 32
  • 107
  • 173
0
votes
1 answer

how can i display the full decimal points for my Decimal(10,4) field

i have a database field with the type of Decimal(10,4) at my SQL server 2008, but on my asp.met mvc view the values will only be displayed with two decimal numbers ,, so let say the value in the database is 10.1234 the it will be displayed on the…
John John
  • 1
  • 72
  • 238
  • 501
-1
votes
1 answer

How to use function parameter on @Url.Action Parameter

Url.Action parameter name as a function parameter. Here i use actionNameParameter as a function parameter now how i write this parameter on url: '@Url.Action(actionNameParameter)' I tried this code but it does not work. But i write like …
nazmul.3026
  • 918
  • 1
  • 9
  • 20
-1
votes
2 answers

The view 'Search' or its master was not found or no view engine supports the searched locations

public ActionResult Search(string name) { if (string.IsNullOrWhiteSpace(name)) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var movie = db.Movies.Where(x =>…
Kahawk
  • 7
  • 3
-1
votes
2 answers

How to declare a variable in mvc view with razor to have html atribute class

I want to display a text with 2 links inside the text in MVC view! The text link are dynamic from server side and looks like this in controller: Model.Message = "You have used up all your credits for this month (see your credit balance…
Dongolo Jeno
  • 414
  • 6
  • 8
-1
votes
1 answer

How to return a view as well as redirect to another action in MVC [or Return a view and reload the current view]?

I have two actions; First One public ActionResult ViewRequests() { List Reqs = con.AgentRequests .Where(x => x.Status == RequestStatus.Open) …
Shafeek
  • 247
  • 1
  • 4
  • 9
-1
votes
2 answers

Can a HTML hidden variable be seen or changed by an end user?

I am coding a MVC5 internet application where some of my Views have hidden values for the ViewModel. Here is an example: @Html.HiddenFor(model => model.id) Is this a safe way to store variables that could potentially be sensitive? By sensitive, I…
Simon
  • 7,991
  • 21
  • 83
  • 163
-1
votes
2 answers

How to show the "A potentially dangerous Request.Form value was detected" view error

I am coding a MVC 5 view, and have a question in regards to detecting a HttpRequestValidationException. Here is the controller code: public async Task TestView() { return View(); } [HttpPost] [ValidateAntiForgeryToken] public…
Simon
  • 7,991
  • 21
  • 83
  • 163
-1
votes
1 answer

Getting the caller name from inside of the view

I'm invoking my view using @Html.EditorFor(m => Model.FileListBefore) I would like to get the 'FileListBefore' name from the inside of the view. How can I do that? EDIT (more info): 'EditorFor(m => Model.FileListBefore)' uses my own sub-view. In…
Paul K
  • 41
  • 1
  • 8
1 2 3
11
12