Questions tagged as 'asp.net-mvc'

4
answers

Access javascript variable in loop with model

I'm creating an Asp.Net MVC project and found a problem in View. See the code: <script> var data = []; for (var i = 0; i < '@(Model.Count())'; i++) { data[i] = { "source": '@(Model.ElementAtOrDefault(0).Source)',...
asked by 09.04.2015 / 13:56
2
answers

Help in javascript and asp.net mvc

In my project I have a field that is the Status of a given occurrence. That is, whether it is pending or resolved. I made a function in javascript that, when clicking the input field that is in readonly mode, changes the background. I mean, if t...
asked by 02.06.2014 / 20:16
2
answers

Is it correct in MVC to access data within the model?

In a C # MVC project, is it okay to access data within the model ? For example: public class Cliente { public int Id { get; set; } public string Nome { get; set; } //outros atributos... public void Inserir(){ Client...
asked by 26.10.2017 / 16:16
3
answers

Return the previous page with the back button

I have a back button that supposedly should return to the previous page, regardless of which page on the system. How can I do this using MVC 4? Does returnURL have anything to do with this feature?     
asked by 30.05.2014 / 16:21
2
answers

Problem sending model to controller

I'm having trouble forwarding my model to the control: Class: public class Pessoa { public virtual long Id {get; set;} public virtual string Nome {get; set;} public virtual ETipo Tipo {get; set;} public...
asked by 31.03.2017 / 19:17
4
answers

How to hide the time of a "DateTime?" field in the user interface?

The time is showing up for the user. My question: is it possible to hide the time and show only the date? How are you looking: Modelcode: View code:     
asked by 05.02.2014 / 18:32
3
answers

Calling Controller Method

I'm doing a project for the Faculty, and I'm having a hard time understanding how to create a button and call an ActionResult on the Controller, and wanted to know if the action needs to be on the corresponding controller of the respective Model...
asked by 28.10.2016 / 04:32
1
answer

Display value (decimal) without rounding

I have a database that has the following values: 48.205864 So, when I simply make a select , and bring it to the screen, it looks like this: 48,21 What do I need to do so that the value is not rounded up in C #, and disp...
asked by 28.09.2016 / 04:20
3
answers

HTML Helpers in ASP.NET MVC 4

I have seen some HTML Helpers like this: @Html.LabelFor(x => x) and @Html.LabelFor(model => model.Propriedade) , however, I do not understand this parameter that I should pass, x => x , what is this?     
asked by 08.11.2014 / 13:42
2
answers

Using interfaces for domain classes

Is it a good practice to make use of interfaces for domain class? Do I have an advantage doing this? If so, which one? Example: public interface IAuditoria { long AuditoriaID { get; set; } string Descricao { get; set; } string S...
asked by 25.07.2018 / 19:14