Most voted "asp.net-mvc-4" questions
ASP.NET MVC 4 is the fourth version of the Model-View-Controller ASP.NET platform for web applications.
Learn more…135 questions
Sort by count of
-
16
votes2
answers10265
viewsUse of DTO and Viewmodel in ASP.Net MVC project
I have an ASP NET MVC 4 project with the following projects: Domain Repository Contracts (interfaces) DTO’s And the web project The web project "sees" only the repository project and it is…
-
14
votes3
answers1073
viewsIs controller returning HTML to View wrong?
I used this solution because when trying to render a Table in a view with many records the user’s browser gave Crash, I know it is a solution not much elegant but it was the only solution that came…
-
11
votes2
answers1359
viewsWhat changed from MVC4 to MVC5?
I have read some topics on the subject, some say that it has changed very little, others say that they were very important changes. I would like to know your opinion on the subject, currently I do…
-
7
votes4
answers1531
viewsList all Roles in Checkbox and mark the roles that the User has
I am creating an Asp.net MVC 4 User Management System with two Simple Tables. Users and Roles. I can create users by selecting the roles they will own. At the time of Edit I’m trying to List all the…
-
7
votes2
answers4310
viewsHow to prevent a property from being mapped to an entity in the Entity Framework?
I need to enter a property in the model class, but when I enter the code first, it says the table already exists and changes have been made. My code: public class Data { [Key] public int Id { get;…
c# entity-framework asp.net-mvc-4 property code-firstasked 10 years, 8 months ago Luciano Azevedo 402 -
7
votes1
answer541
viewsCustom Roleprovider
I am implementing an authentication with RoleProvider Custom. I have a class Usuario and a class Role with Many to Many relationship. I created a folder in the project called Security and inside the…
-
6
votes1
answer5794
viewsHow to use MVC 4 session with C#?
My scenario is as follows. I have an MVC 4 application. In my controller I check the logged in user and password. (I think) I put the user data in a session after the data is checked and correct. My…
-
6
votes3
answers1799
viewsWhat a difference between Dropdownlistfor and Dropdownlist
What a difference between Dropdownlistfor and Dropdownlist? And when and which to use?
-
6
votes1
answer1140
viewsSecure Return - Solution
I use C# Asp.Net MVC, I had to make the return of data Secure Pag and I found very flawed the documentation, follows the solution I created below for those who go through the same difficulties.…
-
6
votes1
answer289
viewsDropdown filter using C# MVC 4
I have a dropdown in my view that I fill in the following way: ViewBag.NfeStatus = EnumHelper .ListAll<NfeStatus>() .ToSelectList(x => x, x => x.Description()); My model Nfestatus is an…
-
6
votes1
answer116
viewsSort 2 columns at a time - Asp Mvc + Fluentnhibernate
Good morning! I would like to know how to order two columns at once in a query so that in my case, 1 in descending order of date but in alphabetical order. public IList<Analise>…
-
5
votes3
answers523
viewsDynamic display of mandatory, optional or non-existent fields
There is a class that has 12 properties, which in its insertion in the database may be mandatory, optional or non-existent, depending on the business rule specified in the registration of another…
-
5
votes3
answers1456
viewsEncapsulate values returned by JSON within a single object
I have a question, I have this code below on controller: [Authorize] public JsonResult Teste() { var licencas = new List<Object>(); licencas.Add(new { Responsavel = "José", Ticket = 79007,…
-
5
votes4
answers1684
viewsDynamically check which attributes of a Model have been changed?
I am developing an ASP.NET MVC 4 application and need to save the log of each change made in a Model object. Is there any native method or implementation already known to do this? Example: public…
-
5
votes2
answers1071
viewsHow to know the name of the Actionresult that called the view?
I wonder if it’s possible to get the name of ActionResult who called the View. I know that normally View has the same name as ActionResult, but in my case, I have a single view for two ActionResult…
-
5
votes2
answers544
viewsProgress bar on file upload and information registration
I’m developing a project, where I upload files, as well as a record of information. Both the file and the information are registered in the same form. So far so good, but usually, when there are…
jquery asp.net-mvc asp.net asp.net-mvc-5 asp.net-mvc-4asked 9 years, 3 months ago Leomar de Souza 1,074 -
5
votes4
answers5763
viewsCapture Real User IP
How do I capture the actual Public IP/IP of the user accessing the application? The IP address of the computer I can capture normally, but I want to know the public IP address of this client.
asp.net-mvc asp.net asp.net-mvc-5 asp.net-mvc-4 asp.net-identityasked 9 years, 2 months ago Leomar de Souza 1,074 -
5
votes1
answer276
viewsHow to use Format: Webgrid?
I am developing with MVC, and I have the List view [...] var columns = new WebGridColumn[] { grid.Column("Id"), grid.Column("Descricao"), grid.Column("UsuarioModificacao"),…
-
5
votes2
answers62
viewsError sorting list?
ViewBag.ListaEspecialidades = Especialidade.ListarEspecialidades().Sort(); Of a mistake "cannot implicitly Convert type void to Dynamic".…
-
5
votes2
answers109
viewsQuestions about Fluent API relationship for EF 5
I have two classes: User > Contains your PK (ID). User > Contains the user ID(FK). Class User.Cs public Usuario() { this.UsuariosP = new List<UsuarioP>(); } public int Id { get; set; }…
-
4
votes2
answers144
viewsCompare Dayofweek in an ASP MVC query
I’m trying to make a query where I check if the day week is chosen to create a list of data that loads in a Viewmodel. Query: var plan = db.Servicos.Where(s => (TecnicoResp.HasValue ?…
-
4
votes4
answers1399
viewsDatabases for different customers
I am learning MVC 4 and would like to know if there is a way with only 1 model access different databases? For example, I have an online system and for each customer I have a separate bank. What…
-
4
votes1
answer311
viewsBootstrap organization and maintenance
I am starting with the use of Bootstrap with MVC 4 and during the planning I noticed that the main screen of the system will have many Divs. Many of them can be repeated (exactly the same) on other…
-
4
votes1
answer938
viewsRDL Report of Report Builder 3.0 with MVC 4
I have a problem here, I made a system in C# using Razor MVC 4 with SQL Server 2014 database, so far so good... but now I need to generate reports, I made a report there in Report Builder and added…
c# mvc visual-studio-2013 asp.net-mvc-4 report-builderasked 10 years, 3 months ago Jeferson Santos 41 -
4
votes1
answer81
viewsController and action routes in lower case
How to make the routes of controllers and actions are all in lower case? For example: instead of Noticias/Details stick around noticias/details.…
-
4
votes2
answers1380
viewsCapture Machine Identification with C#
Good morning, I have several computers with the same output IP, how can I get any information that leads me to know which computer a request came from? I use C# Asp . Net MVC
-
4
votes3
answers152
viewsViewdata error in controller
What could be wrong in this example? I can’t do it: var pessoa = new Pessoa ( PessoaId = 1, Nome = "teste teste", twitter = "@teste" ); Error message: 'Name' does not exist in the Current context…
-
4
votes1
answer587
viewsHow to communicate a local application with an open web page in the browser?
I have a commercial web application that runs basic restaurant operations. In summary, a waiter accesses the 'orders' page and requests a new 'product'. These products are classified by departments,…
-
4
votes1
answer30
viewsUsing KEY element
In my model, I use a view that is built on the basis of certain joins of tables, which have no auto incrementable ID element. My model requires that I assign a TAG Key, however, as I have no single…
-
4
votes2
answers419
viewsWrite access log to ASP NET MVC application
I have an ASP NET MVC site and I need to record it in the database every time someone accesses by recording the client’s IP and access date, is there any way to do this? I don’t want to record every…
-
4
votes1
answer93
viewsOnselectionchanged MVC
Late, How can I call the Onselecionchanged event from a DDL using MVC? I have the following DDL: @Html.DropDownListFor(model => model.Type, ViewBag.Type as SelectList, "-- Select --", new { id =…
-
4
votes1
answer216
viewsTranscribe SELECT to LINQ query expression
How can I reproduce the query then to LINQ expression? SELECT nome_empresa, Count(funcionarios.id_funcionario) AS qtdfuncionario, Count(id_colaborador) AS qtdcolaboradores FROM empresas JOIN…
-
4
votes1
answer623
viewsRedirect to error page when entering catch
I have a question as to a possible improvement in the method when an error occurs in a Action and redirect to an error page. At the moment, I do so on Action: public ActionResult Index() { try {…
asp.net-mvc asp.net asp.net-mvc-5 asp asp.net-mvc-4asked 8 years, 5 months ago Leomar de Souza 1,074 -
4
votes1
answer1107
viewsA3 Certificate in ASP.NET MVC and IIS
I have an ASP.NET MVC4 application and use the following code to read the A3 certificate (reader or USB stick) of the user: var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);…
-
4
votes2
answers638
viewsInsert checkbox dynamically by returning Json does not display Text?
I’m creating a list of Checkbox according to the selection of a Select on the same screen. No event change of select is called via ajax javascript, the method that returns a Json with list(value,…
-
3
votes1
answer663
viewsValidation of Client fields in ASP . NET MVC 4
I’m needing to do field validations on a system both on the client side and on the server side, on the server side I’ve already been able to do, but I couldn’t find any way to do client side…
-
3
votes1
answer399
viewsASP NET MVC project architecture
What would be the best way to store user files according to the requirements below: The user can send one or several files at once; The type of files accepted by the entire application are: mp3,…
-
3
votes1
answer1517
viewsSelect only one Radiobutton with Razor
I have 2 Radio Buttons, and I would like when I mark one, the other to cancel. Follow the image of what is occurring: Code: @Html.RadioButton("teste", "teste", true) Teste…
-
3
votes1
answer628
viewsCombo box with search
I need to create a combobox that allows the administrator to search the user and that while the administrator searches, already appear within the combo some options that are similar to what was…
-
3
votes1
answer1236
viewsIdentify Area, Controller, and View Action
I need to create an Htmlhelper (MVC 4, C#) that identifies and tells what is the Area, Controller and Action of a View. I’m not getting anything. How can this be done? Is there a function or method…
-
3
votes1
answer622
viewsMaster Page does not appear in the list when I try to associate it to a view
I am using Microsoft Visual Studio 2013 and created a C# ASP.NET MVC 4 project. I created a Master Page in the directory of Views, calling for Modelo.master. Then I created a Controller in the…
-
3
votes4
answers1604
viewsAccess javascript variable in template loop
I am 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":…
-
3
votes1
answer68
viewsHow to save Dysicpline?
I have the following problem with my application. The course table is related to the Discipline table, that is, 1 Discipline belongs to several courses, and at the time of registering a course and…
-
3
votes3
answers241
viewsURL of route being incorrectly mounted
I am with a project in Asp.net mvc 4, using Attributerouting to set up the routes, and I’m checking a strange behavior. When mounting my GET and POST actions in that order: [GET("editar/{id}")]…
-
3
votes1
answer310
viewsValidate custom fields of generated classes
To prevent validations made with Data Annotations are lost if the table structure changes, it is necessary to create another class with fields for validation and a class partial, path that this last…
-
3
votes1
answer791
viewsCascade Dropdownlist MVC 4
View: <asp:Content ID="Javascript" ContentPlaceHolderID="HeadContent" runat="server"> <script type="text/javascript"> $(document).ready(function () { $("#estados").change(function () {…
-
3
votes1
answer478
viewsA dynamic field for each database record
I have a property called Productdevelopment where I have several functions and must assign a user to each function. I have an Editortemplate to return a list of users. I have to create a dynamic…
-
3
votes1
answer1261
viewsInclude Method - MVC - working with data insertion in two tables
I have two classes: User User where Usuario possesses its id (PK) and UsuarioP owns the id (FK) of Usuario. I am working on ASP.NET MVC 4 using Fluent API. Classes are mapped within the project to…
-
3
votes1
answer124
viewsDisplay a button based on the action of another
I’m a beginner in Asp.net MVC I have a project. And within a certain view I have two buttons. However, one can only appear if the other is executed. 1 Button > Save (save car) 2 Button>…
-
3
votes1
answer154
viewsASP.NET MVC Query Portal 4
Work in a service provider company. In the company we have hundreds of databases Oracle and SQL-Server of all customers. These banks contain information on the existing assets in that company as…
asp.net-mvc-4asked 8 years, 7 months ago Reginaldo Rigo 3,638