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
votes1
answer790
viewsOpen a folder on the user’s machine and open a file (csv,txt or xls)
How do I open a folder on the user’s machine? I need to open the folder and upload a csv, txt or xls file. I use MVC5 That would be about it. A button that clicks in the folder and then I click that…
-
2
votes2
answers3544
viewsCalling a jquery function when changing tabs
I have a jquery function that mounts an html. It turns out there is a View with 4 tabs. When selecting a particular tab, the function is called and of course, load the dynamic html to assemble the…
-
2
votes1
answer220
viewsHow to list related data
In my project I have two tables: Student and Occurrences. And they are related so that a student can have several occurrences. My need is: In the Student Details view (Details.cshtml), I need to…
-
2
votes1
answer1006
viewsHow to make a script run only once?
I’m using Asp.net MVC In my layout I have a menu div and I have the container div where my @RenderBody() And downstairs I have a script that pays for my menu: $(document).ready(function (e) {…
-
2
votes1
answer324
viewsEntityexception when connecting to remote database
When connecting to the local bank, the application works 100%. However, when I try to connect to sql server remotely (on a redehost server), the application raises the following Exception: Below is…
-
2
votes3
answers679
viewsError generating PDF with Rotary
Guys, I’m having a problem here to generate a pdf with the data coming from the bank. My system has a register of students and their occurrences. What I wanted was that, at the time of detailing the…
-
2
votes1
answer490
viewsHow do I get an Annotation date, to be able to access value from another property?
I have my following properties: public ETipoPessoa TipoPessoa {get;set;} public string CnpjCPF {get;set;} public enum ETipoPessoa { Fisica, Juridica } I have this condition, if Type = Physical, I…
-
2
votes1
answer322
viewsAccess to DAL data with ASP.Net MVC Identity and Owin
Today my solution has a MVC 5 Web application project and a DAL Library (Data Access Layer) with EF Databasefirst. I want to create a layer with MVC Identity + Owin, however I would like the data…
-
2
votes1
answer321
viewsFluent Mapping or Data Annotations?
I was watching a video class on ASP.NET MVC, when I watch the Fluent Mapping of the Entity Framework for the first time. Then the doubt came to me. Which of the two is best recommended? Fluent…
-
2
votes1
answer1223
viewsComplex query when passing parameters
I need to make a query, but I’m having a hard time. I have 5 filters on the page. Three of them come from three dropdown (select). I can only consider select if the text in them is different from…
-
2
votes1
answer53
viewsCan I edit my router at runtime?
I have the route of my area context.MapRoute( "Cadastro_default", "{Empresa}/Cadastro/{controller}/{action}/{id}", new { empresa = Empresa.GetEmpresa(), action = "Index", id = UrlParameter.Optional…
asp.net-mvc-5asked 10 years, 1 month ago Rod 9,412 -
2
votes1
answer1709
viewsFunction not defined with javascript
I made a cshtml and in it there is a button that calls my function that inserts in the BD. It turns out that when I click the button, it gives me this error: Uncaught Referenceerror: Insert…
-
2
votes1
answer628
viewsGenerate database backup via application
In my project I connect to the database. Is there any way I can do the backup from my database via Asp.net mvc 5 and keep that backup in a directory, either at the project root or in a folder in a…
-
2
votes1
answer1195
viewsHide Actionlink parameter
For example: /admin/Edit/1006 Is there any way to hide this id? So any malicious user can change the value and end up finding a user. I know you have to check the controller to see if the user can…
-
2
votes1
answer4300
viewsRecover value from an HTTP query string
I have a URL where it returns an HTTP QueryString, and I need to retrieve the information from the URL and convert it into variables to make queries in the database. In PHP just use the $_GET[""],…
-
2
votes1
answer735
viewsRegularexpression only letters in the Model
Using the following Regularexpression in the Model: [RegularExpression(@"^\d+$")] public int ano_da_configuracao { get; set; } I get the following result: I tried as follows to accept only letters:…
-
2
votes1
answer1346
viewsError while using iframe
I have an application developed in Asp.NET MVC-5 and published on IIS normally. When accessing the application by the link the same works correctly, all links. However, I need to place this page…
-
2
votes1
answer1577
viewsDoubt about X-Frame-Options
Yesterday I had a problem with the X-Frame-Options, as can be seen in this post. However, I added the solution, and it worked perfectly. I’ve added the solution, but I have no idea what it does, and…
-
2
votes1
answer148
viewsTesting of variable content
Using ASP.Net MVC and Angularjs I tested the contents of a view thus: $scope.estado.ldRedeBasica = @(Model.ldRedeBasica == null ? "[]" : Html.Raw(Model.ldRedeBasica)); Only it returned the following…
-
2
votes1
answer552
viewsRequired Errormessage dynamic content
Using Asp.Net MVC 5 need to create a required message with the following format: "Required field! [Social Reason]" Normally I would do so: [Required(ErrorMessage = "Campo de preenchimento…
-
2
votes1
answer6706
viewsLogin system in Asp.net mvc
How do I implement a login system in an Asp.net MVC application. Do I use Forms Authentication or Identity? I’ve been reading about Identity and wanted to see a basic example of Identity using the…
-
2
votes1
answer123
viewsDecrease in a field of table Asp.net MVC
I am developing course manager in Asp.net MVC, and in the course table has a field qty vacancies. I wonder how I do to make one Count-- (or some other way to Decrease) this field. For example: In…
-
2
votes1
answer285
viewsUsing Identity in an Asp.Net MVC 5 application with Web Api and vice versa
When I create a project Asp.Net MVC with Individual User Accounts i can get into the application this way: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password,…
-
2
votes2
answers971
viewsForm single field validation in Asp.Net MVC
I am developing an application that manages enrollment in courses, and in my registration form I have the field CPF, and I would like to know how I make this field unique, IE, bar the user to make…
-
2
votes1
answer1474
viewsLogin with Identity no MVC 5
I’m using MVC 5 and Identity for Login. I have a User class and want to log in with it, using the properties of this class for example the Record(User) property instead of the…
-
2
votes2
answers313
viewsHow to create an input grid in Asp.net C# - MVC5
Basically I have a form and I am opening a window (modal) with a list of employees and by javascript I can add the email of the same in the form that will be saved, in another language in this case…
-
2
votes1
answer187
viewsGlobal Filter on MVC 5 not working
Hello. I am following the tutorial below with the intention of better understanding the authentication process of . net Identity with OWIN.…
-
2
votes1
answer94
viewsHow to register a default user at the beginning of the application?
In an ASP.Net MVC application I need to have a default user record and for that I am thinking of adding it on startup of the application. In the archive Global.asax I did the following: public class…
-
2
votes2
answers321
viewsScript to make a div appear
I have a user registration in my application, when I click register wanted to show a message. This whole treatment I’m already doing and playing the message in my Viewbag.Message. How do I show this…
-
2
votes1
answer327
viewsSend two models to a View
I have two models: TBFuncionario and TBEndereço: namespace Lamar.Dominio.Entidade { public class TBFuncionario { public int TBFUNCIONARIOID { get; set; } public string MATRICULA { get; set; }…
asp.net-mvc-5asked 9 years, 3 months ago hard123 2,329 -
2
votes1
answer138
viewsHow NOT to cascade delete records with 1-n relationship using Entity Framework?
I have a table Menu that may have many Categories and these Categories may have only one Menu: public class Menu { public int Id { get; set; } public string Name { get; set; } public virtual…
-
2
votes1
answer292
viewsPick values from Contenteditable fields to send in POST
I’m making a Carousel using the Bootstrap. The dados who fed this Carousel will be modified a few times, I decided to create a file dados.json to serve as the basis for these files. I made a classe…
-
2
votes1
answer163
viewsConfigure Scaffold to generate classes
You can configure Scaffold to generate classes other than the default (Controllers and Views) ?
-
2
votes1
answer282
views404 ASP.NET MVC fails when attached file is large
I’m using the plugin jquery.filer to send files to attach files in my form. I chose this because it was a plugin that managed to manipulate it to send the data of the other inputs along with the…
-
2
votes1
answer203
viewsChoose which items of a enumerator appear in an Enumdropdownlistfor
There is how to select only a few items from the enumerator to send to a EnumDropDownListFor ? Ex: public enum Documento { CPF = 1, RG = 2, CNPJ= 3 NASCIMENTO = 4 } And I would like that in a…
-
2
votes1
answer78
viewsSearch information in more than one table
In my project I currently have 3 tables: Students, Occurrences and Users. In them I have the views and the controllers. So far, so good. My relationships are: Allunos&occurrences(1,N) /…
-
2
votes0
answers37
viewsHow to run a method daily automatically
How can I create an automatic routine in my application to run a particular method every day at 08:00 am in the morning, with the aim of updating a field in a table of my database?
-
2
votes1
answer236
viewsHow to use in @Html.Checkbox?
I have the following code: @{ var st = //(minha lógica q retorna bool); } @Html.CheckBox("MeuNome",st,new { id = "MeuID", value = "MeuValor" }) I can’t use the variable st in the second parameter of…
-
2
votes1
answer141
viewscreate custom mask
How do I create a custom mask for a particular field? The mask will be in the following format: ____OB_____ (4 numbers + OB + 5 numbers) The image below shows the example I want to follow:…
-
2
votes1
answer1119
viewsHow to create a Cascading Dropdown?
I would like to create a Dropdown dependent on another Dropdown in C#, ASP.net - MVC 5, in case it would be a dropdown with the names of all customers and then another Dropdown with the phones of…
-
2
votes1
answer1270
viewsPrevent user from being logged in twice
In my project, I have a login module that works perfectly. Until then quiet, but the way it is I can not bar the same user logged in twice. That is, I can log in with the same user twice, and that’s…
-
2
votes3
answers4358
viewsASP.NET Web Forms or MVC. What’s Best and Fastest?
I have Great Knowledge in Webform, but I see a lot of growth in MVC. Will Webform be extinct ? MVC is better than Webform.
asp.net-mvc-5asked 8 years ago Anderson de Freitas Migloranza 155 -
2
votes2
answers601
viewsMaster Detail with Select2
I’m trying to make a master Detail One of its inputs is a Select2, But it does not generate the Select2, until why it is generated only when finished reading the script, and the second way I did,…
-
2
votes2
answers1051
viewsCopy data from one field to another
My client, requested that I create 2 fields in the system, one as "Cellular" other as "Whatsapp" and that next to the Whatsapp field had a button to copy the value, if the number is the same,…
-
2
votes2
answers196
viewsDoubt cache Asp.net MVC
I have the following scenario: Public ActionResult ProdutoFornecedor01() { var produtos = _db.Produtos.Include(x => x.Fornecedor).OrderByDescending(x => x.ProdutoId).Where(x =>…
-
2
votes1
answer238
viewsRemote validation preventing data editing
I am using remote validation to prevent repeated emails in the database, which works well, when I do some registration. The problem is that the remote does not accept the original registration…
-
2
votes3
answers414
viewsValidation using Remote in the "Parent" class
I have my class Person, it owns the property CPF public class Pessoa { public string Cpf {get;set;} } Other classes inherit from it, for example, the Client class public class Cliente : Pessoa { }…
asp.net-mvc-5asked 9 years, 10 months ago Rod 9,412 -
2
votes1
answer697
viewsLoad external scripts in modal being loaded via ajax
By default, I have a configuration file of various plugins and actions of my system A simple example is the use of tooltip: $(".bn-tooltip").tooltip({ track: true }); Datepicker:…
-
2
votes1
answer468
viewsSort Datatables Component by Date
I’m using the jam Datatables where the birthday of the month returns. I am ordering in my controller per day, and it works correctly in a normal table. There is a way to change the datatable to sort…
asp.net-mvc-5asked 9 years, 10 months ago Randrade 21,612 -
2
votes1
answer2651
viewsChanged RU context, but without updating database structure
I’m using the free hosting service from mee on a free plan. So far so good, everything worked out in a good. But after I made some changes to my database, their database just doesn’t work, it keeps…