Most voted "asp.net-mvc-5" questions
This tag should be used when the question refers to some features only available in version 5 (currently the latest) of ASP.Net MVC. ASP.NET MVC is an open-source Microsoft framework that implements the Model View Controller architecture standards for web development. Based on ASP.Net, allows software developers to build web applications following the Model View Controller architecture standards.
Learn more…937 questions
Sort by count of
-
2
votes2
answers111
viewsError When Generating Scaffold
I scaffolding generating the controller, and Index is showing an error in (f => f.Position) with this mistake: Cannot Convert lambda Expression to type 'string' because it is not a delegate the…
-
2
votes2
answers868
viewshow to work with Partialview
I have the People Register, and I have the Address Register, which are in two separate classes, because the goal is that the user can have 2 or more addresses, as the delivery, and the collection.…
-
2
votes0
answers241
viewsMVC Component for Google Maps
I’m currently using the component Googlemap control for Asp.Net MVC to render Googlemaps maps. I am using this component because I will have to trace the route of a vehicle coming from the database…
-
2
votes1
answer608
viewsGet windows logged in user to automatically authenticate on a website published in IIS 7.5
I am creating a web application with ASP.NET MVC 5, where when a network user accesses the address of my application by the browser the systems already automatically pick up which user is trying to…
-
2
votes2
answers490
viewsHow to save data to SQL database - Submit
I am studying ASP.NET MVC, I am using the Identity to carry out user control and etc. So, I created a page, where the user will enter with 4 information: Mileage Initial; Mileage Final; Quantity of…
-
2
votes1
answer138
viewsWhen changing a Model, how to redo Scaffolding?
I have a model, called CombustivelModels, where I made a Scaffolding generating the Controller and the Views, my doubt is, when making a review on that Model, has how to update via Scaffolding the…
-
2
votes1
answer50
viewsSelections boxes required at least 1 with Data Annotations
In the model I have: [Display(Name = "Exemplo 1")] [Range(typeof(bool), "true", "true", ErrorMessage = "Erro, marcar como true")] public bool Exemplo1 { get; set; } [Display(Name = "Exemplo 2")]…
asp.net-mvc-5asked 7 years, 10 months ago Matheus Miranda 5,375 -
2
votes1
answer757
viewsHow to resize image independent of size?
Follow the code below: public FileContentResult Foto_Pequeno() { byte[] byte_image = null; string query = "SELECT * FROM Imagem WHERE Id = '1'"; using (var connection = new…
-
2
votes2
answers866
viewsToggle - get true or false result
Follows the code: Model: public bool teste{ get; set; } View: <div class="checkbox"> @Html.CheckBoxFor(model => model.teste) </div> HTML result: <div class="checkbox"> <div…
-
2
votes2
answers266
viewsAssociation 1 to 1 Entity
I have a relationship between Address and Academy where 1 address has 1 gym, and 1 gym has 1 address. Academia class: public class Academia { [Key] public int AcademiaID { get; set; } ...…
-
2
votes1
answer292
viewsplace Custom EN Message in required field
Assigns Required="true" in a password field, but the message is in English, as seen in the image below: I wanted to personalize this message by leaving it in PT-BR <div class="form-group">…
-
2
votes0
answers186
viewsHow to configure Owincontext Authentication in Simpleinjector 3.3.2?
In my current application I use Simpleinjector 3.2.0 with a similar configuration to this: var container = new Container(); container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();…
-
2
votes1
answer124
viewsDisplay text coming from the database under @Html.Actionlink()
Well, I have the following scenario: I make an appointment at database and I bring a IEnumerable<> to the View: <section class="container"> <article class="row"> @foreach (var item…
-
2
votes2
answers1383
viewsPick up a selected item on Dropdownlistfor using an ASP.NET MVC Viewmodel
I am trying to register a Subcategory that needs a Category. I have Subcategoriaviewmodel, where I created the fields public IEnumerable<CategoriaViewModel> Categorias { get; set; } and public…
-
2
votes2
answers1081
viewsList table with condition ASP.NET MVC
I’m studying ASP.NET MVC5, so I did one Model called 'Reporteriotagmodels' containing: public class RelatorioTagModels { [Key] public int TagID { get; set; } [Required] public string Tag { get; set;…
-
2
votes1
answer835
viewsUpload images to Asp net core 1.0
Oh guys I’m having a doubt I’m new in the . net, I learned in a course in Asp net mvc 5 so I would need to take that upload code and turn to Asp net core if you can help I am grateful. [HttpPost]…
-
2
votes1
answer255
viewsAsp.Net Razor with Json
I have a question and I have researched several sites but I did not get the answer. I develop systems in .Net with C# in MVC standard and use the on-screen presentation in the traditional View with…
-
2
votes1
answer272
viewsIs it correct to use List with Viewmodel?
I own the ViewModel down below: public class Crm_AnaliseViewModel { public string TAG { get; set; } public int ATUALIZACAO { get; set; } public string RELATORIOS { get; set; } } Then in the…
-
2
votes1
answer114
viewsForm Zera values greater than 999.99
I’m going through a problem I’ve never seen before. I’m hoping someone has seen it and can help me. I’m working with Asp.net mvc 5, and sending a form via post to my controller. My model: <div…
-
2
votes1
answer1154
viewsGlobalize - datetime does not work with en
Please follow the code: Global.asax: protected void Application_Start() { System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("pt-BR");…
-
2
votes1
answer160
viewsASP.NET route does not receive the parameter in Action after being set
I Mapeed a new route on my site like this: routes.MapRoute( "PaymentEdit", "Payment/{type}", new { controller = "Contributor", action = "Payment" }, new { type = UrlParameter.Optional } ); My Action…
-
2
votes2
answers812
viewsbut this Dictionary requires a model item of type 'System.Collections.Generic.Ienumerable`1[Webapplication4.Models.modelExemplo]
I can not carry out enumerate, I switched to another reception of information in the View but I do not know how to correct, I checked other forms in Stackoverflow but I did not understand. Model:…
-
2
votes1
answer260
viewsRoutine to download and unzip zip file on the server itself
I need to develop on my website (ASP.NET MVC) a routine that downloads from another server a zip file made available weekly and unzip in my own hosting service. This routine can be triggered by a…
-
2
votes1
answer71
viewsHow to force the updating of some values when I use the Javascript window.history.back()?
It is possible to force updating some values of my View even when using the window.history.back() of Javascript? My example: In my layout, I have a cart icon with the number of items inside it. When…
-
2
votes1
answer38
viewsError When Customizing MVC5 Routes
Error occurs in method (Registerroutes) in Routeconfig.Cs on line routes.MapMvcAttributeRoutes(); When running in the browser: * The built-in Constraint resolver of type…
-
2
votes1
answer77
viewsIs it possible to insert parameters in Filters Attributes?
I use ASP.NET and to do the access control by level, I use a filter that checks the level of permission of the user and allows access to view. [HttpPost] [AutorizacaoFilterAttribute] //Esse filtro…
-
2
votes1
answer1913
viewsThe name 'Component' does not exist in the current context
I’m trying to create a Component view to reuse on the pages, I’m trying to follow some video tutorials. I’ve installed via nuget the entire Microsoft.AspNetCore.Mvc, but when I try to call it from…
-
2
votes1
answer161
viewsDownload Bank Image with ASP.NET MVC5
I am saving images in the database in varbinary format. byte[] arrayImagem = null; using (MemoryStream memoryStream = new MemoryStream()) { novaSolicitacao.Anexos.InputStream.CopyTo(memoryStream);…
-
2
votes1
answer58
viewsHow to create an index for viewmodel fields to be added dynamically
I am creating some fields dynamically in Asp.net core mvc to register a contact. For this, I use a partialview. Inside a div I’m adding each Row of Fields, as the user clicks on the Add New Contact…
-
2
votes1
answer116
viewsSave Phone Array to Database
I created a table of Clientes and two from customers who are ClientesTelefone and ClientesEmail in my form I am generating email fields and phone dynamically, so I would like to know how I can…
-
2
votes0
answers74
viewsModel not being fully validated
Good morning Guys, I’m testing an application to add a client, but whenever I try to add the user, test the Viewmodel to see if the information is consistent, but the program does not validate all…
-
2
votes1
answer182
viewsHow to pass data from a View to a Model
I searched a lot on Google and Youtube, but I didn’t find anything very clear(I might be searching wrong too). I’m new to Asp.net, and wanted to pass the data from this form (Works.cshtml) to the…
-
2
votes1
answer223
viewsProblems loading Dropdownlist in cascade - Asp.net Core MVC
I have two combobox in which the second has a cascade load that is, when I select something in the first, a query is made in the database and the data must fill in the second... My controller seems…
-
2
votes0
answers78
viewsList files from a folder via ftp with jquery ajax
I need to list files from a folder that sits in one ftp server, how do I access this folder ? The user must select a list item (<select><option></option></select>) called…
-
2
votes2
answers124
viewsJunction of 2 Linq Queries
I am using the mysql database. I have 2 tables one of questions and options related to the question. For every access I make to the system I need to take the questions randomly and obviously the…
-
2
votes1
answer819
viewsCannot Create an instance of the Abstract class on interface 'Httprequest'
I’m getting the following error: Cannot Create an instance of the Abstract class on interface 'Httprequest' In that part of my code: class FakeContext { public static HttpContext FakeHttpContext() {…
-
2
votes1
answer134
viewsHow to perform mathematical operation within the MVC view
I am creating a web application MVC 5 for studies and I have a question: it is possible to perform a mathematical operation in view? I wanted to multiply line 16. What would be the solution?…
-
1
votes1
answer182
viewsHow to change running route?
Use MVC5 and Visual Studio 2013. I created this route: Home/PaginaBase. This route calls a new page, called PaginaBase, which has a header and footer similar to Index. This footer creates a Menu.…
asp.net-mvc-5asked 10 years, 8 months ago pnet 14,727 -
1
votes2
answers452
viewsDynamically fill in combo with MVC 5
In my file .cshtml, I got these divs: <div class="grid_14"> <select id="txtDia" name="txtDia" class="grid_2" required> <option>Dia</option> </select> <select…
asp.net-mvc-5asked 10 years, 8 months ago pnet 14,727 -
1
votes3
answers388
viewsDate reassembly with javascript
In my bank I have a Datetime field. In my form I have three combos for: Day, Month and Year. I have a Javascript function, which serializes the information by sending it to my record controller. It…
-
1
votes1
answer5007
viewsPass parameters via post to Controller
I have a CSHTML where the fields will turn into parameters, which will be passed via post to an existing method in a controller. How do I do this? I am searching, but I still have doubts about how…
asp.net-mvc-5asked 10 years, 8 months ago pnet 14,727 -
1
votes2
answers433
viewsFunction to clear html
How to make a function that cleans HTML? I have a field that comes from a WS and needs, before displaying on the page, to clear HTML. They sent me this: String result = Regex.Replace(htmlDocument,…
-
1
votes2
answers771
viewsBring three possible results with Lambda
I need it in one expression to bring three possible outcomes. If date is up to 15dd, returns 1, if it is between 15 and 45 dd returns 2 and if it is larger than 45 returns 3. This is my lambda and…
-
1
votes1
answer593
viewsProblem redirecting page by route
These are the routes { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Pacotes", url: "Passo/{name}", defaults: new { controller = "Passo", action = "Passo_01", name = "" }…
asp.net-mvc-5asked 10 years, 8 months ago pnet 14,727 -
1
votes1
answer228
viewsHow to avoid page being displayed in another tab
I have this jquery $(window.document.location).attr('href', '/gerenciarpdv'); And that button calls that page <button id="teste1" name="teste" class="btn-pesquisa"…
-
1
votes1
answer138
viewsPreview the data before saving to the database
I’m doing a news site on ASP.NET MVC 5 and the need arose to see the Preview of the news before saving it in the bank. With a action by name Preview I can send the data to her and send it to a View…
-
1
votes1
answer570
viewsFormat JSON wrong web api
I’m having trouble returning json to my mvc 5 api. In the Get method it returns a string in this format: public string Get() { return…
-
1
votes2
answers290
viewsHow to create a checkbox name created with mvc helper
How I use the mvc helper to create a chekbox and with its name attached to the checkbox. And if there’s any way I can put the name of the checkbox on the left or right. I did so and it didn’t work:…
asp.net-mvc-5asked 10 years, 6 months ago pnet 14,727 -
1
votes2
answers7317
viewsHow to create user with encryption password?
As I do in my ASP.Net MVC 5 and EF 6 application to save encrypted passwords in MD5 format when creating users?
-
1
votes1
answer873
viewsChange font size using @Html.Label
How do I assign a font size and colors using @Html.Label? I know if I use htmlAttributes I can use: @class = ... i get via css. But I wish I could do it without using CSS. It’s like?…