Questions tagged as 'asp.net-mvc'

1
answer

Error Customizing MVC5 Routes

The error occurs in the RegisterRoutes method in RouteConfig.cs on the routes.MapMvcAttributeRoutes(); When running in the browser: * The built-in constraint of type 'DefaultInlineConstraintResolver' could not resolve the follow...
asked by 18.01.2018 / 21:55
1
answer

C # Decimal field accept value equal to or greater than 0 in validation

I'm having problems validating my fields of type decimal using Razor, when I try to enter 0 in the field it gives the following error message.    The field XXXX must be a number. Below is my class and how I enter the field with Raz...
asked by 15.12.2017 / 14:31
1
answer

HttpPostedFileBase always empty when passing to the controller

I am sending a form to my Controller by passing a HttpPostedFileBase as a parameter. The problem is that it always comes empty. HTML : <form action="@Url.Action("Import","Importacao")" method="post" class="form-horizontal"> &l...
asked by 20.07.2017 / 20:29
1
answer

Regex for capturing fixed strings in HTML and JS codes [closed]

I am doing some automated testing for a legacy project in the MVC template, however there is a requirement for one of them that is capturing all fixed strings in HTML and JS codes. Since the project company is undergoing an internationalizatio...
asked by 11.05.2017 / 17:37
1
answer

Edit object with related objects

I have an object Cliente that relates to two other objects. [Table("Cliente")] public class Cliente { [StringLength(100, ErrorMessage = "Este campor permite apenas 100 caracteres"), Required] public String Nome { get; set; } ......
asked by 08.05.2017 / 14:23
1
answer

The 'connection' object can be dropped more than once in the method

Follow the code: public ActionResult Index(ViewModel model, string returnUrl) { string query = "UPDATE Table SET Status = 'C' WHERE Id = @Num"; using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings...
asked by 07.05.2017 / 05:09
2
answers

Project empty MVc. I can not start

I started doing a project from scratch using MVC 4 of VS 2012. As I opted for an empty, I can not start the view. I made the route: routes.MapRoute( name: "Operador", url: "{controller}/{action}/{id}",...
asked by 07.10.2015 / 22:36
1
answer

CSS Setup for Dot Matrix Printer

Well, my problem is this. I am developing a web system and I use ASP.NET MVC, I was able to generate a tab where the layout I present is null . However, I was unable to set up the print correctly for a dot matrix printer. The size of the m...
asked by 31.10.2016 / 14:21
1
answer

How to use Ajax with AntiForgeryToken?

Follow the code: //AntiForgeryToken function gettoken() { var token = '@Html.AntiForgeryToken()'; token = $(token).val(); return token; } Ajax and formData: var formData = new FormData(); var file = document.getElementById("im...
asked by 13.01.2017 / 01:31
1
answer

Null attribute check in @ Html.DisplayNameFor

I need to check if the attribute of a class is null. If it is null, I would like to hide your label. Here's an example of how it's being viewed today: TheDataFinalizacaoattributewasnull,soitwouldnotdisplayitslabel.BelowisthestructureoftheHTM...
asked by 13.09.2016 / 19:50