Most voted "asp.net-mvc" questions
ASP.NET MVC is an open-source Microsoft framework that implements the Model View Controller architecture standards for web development. Based on ASP.NET, it allows software developers to build web applications following the Model View Controller architecture standards, featuring a variety of features following recent trends.
Learn more…3,385 questions
Sort by count of
-
2
votes2
answers42
viewsModifying my Isauthenticated value in Angularjs
When the token is different from null my Isauthenticated has to be positive, app.controller("HomeCtrl", function ($scope, $location) { let token = localStorage.getItem("token"); $scope.user =…
asp.net-mvc angularjs validation angularjs-scope tokenasked 7 years, 8 months ago Jefferson Souza 167 -
2
votes1
answer160
viewsHow to pass more than one parameter to a Controller?
I am in need of a backup to pass more than one parameter to a Creation Controller. I have some models as below: Usuario : Brings the information of the user who opened the call ex. id_usuario,…
-
2
votes2
answers279
viewsDownload PDF file by link in e-mail
I developed a function that passing the Item id it generates a PDF file. [HttpPut] public void GerarPDF(long idItem) { ....Função } It already works perfectly, I did the test through the Google…
-
2
votes1
answer71
viewsCodefirst Entity Framework database, 1-0.. 1, 1-N
I have 3 tables and need to relate them via code (Code First) I would like to know how to do this. I already have the following table codes: Tbhistoricoanalogic using System; using…
-
2
votes2
answers278
viewsSpecial character encoding before going to the SQL database
I am working with SQL Server 2008 and IIS7 to host my MVC website. For security reasons, the website on which I work at the moment does not allow strings with special characters like '<' or…
-
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
answer508
viewsPicking up a specific file in an FTP directory
I have two methods, one sends a file by FTP and the other consumes a file by FTP. The files have the dynamic name DateTime.Now each day a new file. example: collections-04-04-2017 16_00_19.xlsx In…
-
2
votes1
answer278
viewsHow to avoid blocking requests?
I’m doing a project in ASP.NET MVC + IIS and realized that when making a request to a page with long reading in the Database (using Entity Framework), if I open another window and try to access any…
-
2
votes1
answer162
viewsWhat does everything in this method do? (Mirror Audit in Entity Framework)
Well, following this excellent reply of the Gypsy, where he implements a form of Auditoria Espelho, where it is implemented in the DbSaveChanges() the following method: //Laço de repetição em…
-
2
votes1
answer61
viewsValidate Streamreader twice
I get a. csv file in my Controller. This file may contain two templates, with 2 or 5 lines. First I have to do the validation to check if the file contains 5 lines: var arquivo = new…
-
2
votes2
answers1143
viewsCreate Javascript mask using jQuery
I have a customer registration page in my MVC project requesting standard data such as name, Cpf, dt nasc... I need to create masks of these fields. After researches I reached the plugin offered by…
-
2
votes1
answer463
viewsError saving list of related objects
I’m using the BeginCollectionItem to insert objects related to a Cliente which I call Dependentes. When saving, I have the mistake: Violation of PRIMARY KEY constraint 'Pk_dbo.Dependents'. Not…
-
2
votes1
answer185
viewsThe 'Connection' object can be discarded more than once in the method
Follows the code: public ActionResult Index(ViewModel model, string returnUrl) { string query = "UPDATE Table SET Status = 'C' WHERE Id = @Num"; using (SqlConnection connection = new…
-
2
votes1
answer1000
viewsRecover image through path and display
I created the following method to save an image in the database public ActionResult enviaArquivo(UsurioViewModel arq) { try { string nomeArquivo =""; if (arq.Arquivo != null &&…
-
2
votes1
answer77
viewsError in Transactionscope
I’m trying to accomplish a TransactionScope but it always gives me a mistake: Server Error in Application '/'. A Second Operation Started on this context before a Previous asynchronous Operation…
-
2
votes1
answer167
viewsEdit object, with related objects
I Have an Object Cliente relating to two other objects. [Table("Cliente")] public class Cliente { [StringLength(100, ErrorMessage = "Este campor permite apenas 100 caracteres"), Required] public…
-
2
votes1
answer112
viewsCreation of anonymous objects vs "named (?)"
I have a class that loga some information in the database I am using it in the following way: new StudyLogRepository().Create(new StudyLog() { StudyId = Study.Id, CycleId = null, DateOccurrence =…
c# asp.net-mvc .net entity-framework pattern-designasked 7 years, 6 months ago Jhonatan Jorge de Lima 1,012 -
2
votes1
answer139
viewsRegex to capture fixed strings in HTML and JS codes
I’m doing some automated testing for a project legacy in the MVC model, however, there is a requirement for one of them to capture all fixed strings in HTML and JS codes. Since the project company…
-
2
votes3
answers525
viewsHow to insert an existing record into the Entity Framework?
At some point in the system some records are selected and should be replicated by changing only one value. At this point I am selecting the records I need to enter: listaRegistros = listaRegistros…
-
2
votes2
answers437
viewsPutting social media buttons on the site
I am "playing" with the SPA MVC(C#) and would like to know how I put the social media buttons on my site. I looked for some examples here on the site and by my query, I found nothing that satisfied…
-
2
votes2
answers434
viewsInput Submit does not call Actionresult
I’m having trouble calling Actionresult using input type="submit" and pass the model data. I did a test using ActionLink but Model is not sent. Someone could shed a light? Here is the code:…
-
2
votes1
answer68
viewsHow to create a View for screens with width less than X
I have a site MVC4, which is not responsive, and change all its implementation just to make it responsive does not seem to me at all productive, because it is a site where worked many people and…
-
2
votes1
answer112
viewsDoubt with List C#
After consulting the data, keeping them in memory and using "Contains" to locate a product, what would be the best way to do this? thanks I have my DAL: public class BuscaProdutosDermaDAL { private…
-
2
votes3
answers725
viewsASP.NET MVC Web - How to separate performance between the modules of a project?
Explaining the doubt. Within my system there are some menus, we will use as example 3, naming them A, B and C, each being a CRUD module with some kind of report. If 300 people are using module A, it…
-
2
votes2
answers121
viewsHow to screen a serialized object?
I’m trying to convert an object that contains a relationship and Serializando afim, to send it to View by Ajax. I have two related classes public class Eventos : IEntidade<EventosAuditoria> {…
-
2
votes1
answer1305
viewsGenerate more than one PDF in memory and export it in a compressed file
Currently the code below exports and compresses the PDF one at a time and need to export multiple PDF in one compressed file public ActionResult PDFTodosMesAtual(ProcessamentoRegistros…
-
2
votes1
answer65
viewsEnable an input field according to an Enum
I have an Enum of schooling if in case the user selects the level of education as an incomplete or complete superior I want to appear a field to insert which is the course How can I do that ?…
asp.net-mvcasked 7 years, 5 months ago Alerf Morais 121 -
2
votes2
answers1339
viewsOpen PDF in browser automatically after download
The downalod from the PDF is executed correctly (is minimized at the bottom corner of the browser). How to make it open automatically in a new guide ?: <a href="#" class="download"…
-
2
votes1
answer1635
viewsReturn Controller List to View
I have a controller where the information of the ModelState, store errors in a list. I would like to take this list and return to my view. But I’m a beginner and I’m not getting to understand how I…
-
2
votes1
answer2388
viewsHow to download file via $.ajax()
This doubt arose from this post Send data to an Actionresult from a Controller other than the current one answered by Tiago S, currently have this ActionResult that downloads file through a Post in…
-
2
votes2
answers104
viewsRemove user without deleting from database
I need help from you, I created two classes within my Controller, where I can remove a user from one page and send to another. As if deleting but not erasing from the database. I created a variable…
-
2
votes1
answer293
viewsHow to map the results of a previous store to an entity using Entity Framework?
Personal talk. I’m doing a project with MVC 4 and EF6. I’d like to call in a proc and her results populate an entity. But my entity is not a bank table, so I did not use Dbset on it. What happens is…
-
2
votes1
answer3360
viewsDate format in Asp.net mvc
I’m having problems with the date format on en in an Asp.net mvc application. Where it displays error if the date is in the form dd/MM/yyyy HH:mm, and only let it pass if the date is in the formed…
-
2
votes2
answers318
viewsObject array in ajax with mvc
I have a function that takes the variables from a list, creates the objects, and inserts them into a list of objects. But I need to pass this list to the mvc controller; Jquery function $(function()…
-
2
votes1
answer199
viewsSending shortened date does not work abbreviated Asp.net mvc
I am creating a form in ASP.NET MVC and, creating the field "Datamessage", I initially put Textbox to load a date with the month in full, as below: Image of the form with the field "Date of the…
-
2
votes1
answer55
viewsC# - Use form data in IF
I am trying to recover data from the form and need to use them in an IF. protected void btnSubmit_Click(object sender, EventArgs e) { try { if (txtLocalizacao.Text != "") { conn.Open(); SqlCommand…
-
2
votes1
answer1152
viewsSending complex objects via Httpget
I have a search method in my Webapi, as it is a search, I used [HttpGet], as a parameter of this method, I pass an object with the filter options I want, for example: public class ParametrosBusca {…
-
2
votes2
answers1028
viewsHow to query containing MAX and COUNT via LINQ
I got the following model: public class Crm_Analise { [Key] public int id { get; set; } public string cod_item_CRM { get; set; } public string TAG { get; set; } public string data_creat { get; set;…
-
2
votes2
answers554
viewsWhere to place a non-entity object in the DDD
My ASP.NET MVC project in C# has a Domain layer where I have entities, and business rules. I need to add a new rule where I should return an object with an internal list, but I ended up having a…
-
2
votes1
answer209
viewshttppostedfilebase always empty when switching to controller
I am sending a form to my Controller passing one HttpPostedFileBase as parameter. The problem is that it always comes empty. HTML: <form action="@Url.Action("Import","Importacao")" method="post"…
-
2
votes1
answer397
viewsXml Treatment with ASPNET MVC Core?
I’m working on uploading Xml using the ASPNET MVC Core, I get in the controller the file this way: public async Task<IActionResult> Upload(IFormFile param) { } but I need to check it before I…
-
2
votes1
answer3085
viewsGrab a list from the View and move to the controller c#
I have 2 lists that come from the database, one from technical and another from suppliers. I’m not able to take the View and pass to the Controller. And how to receive this list in the controller…
-
2
votes2
answers1884
viewsWhat are model and model variables for in a View?
What are variables for @model and Model in a view? In my view I use it at the beginning of the code: @using Html5DataList.Models @model List<Estabelecimento> And to access the data, I use it…
-
2
votes2
answers262
viewsDropdownlistfor selected values do not persist
I am using Asp.net C# with mvc 4 and in my View I have a Dropdownlistfor, with a class I used of bootstrap-multiselect, as in the image: And the code in the view: @Html.DropDownListFor(m =>…
-
2
votes3
answers3104
viewsError when adding Controler to ASP.NET MVC
Good morning, I am making a small solution using ASP.NET MVC with Entity Framework 6 to meet a work of my course. I believe the context class: namespace WillianRibeiro.EstudandoMVC.Web.Data{ public…
-
2
votes1
answer196
viewsASP.NET.MVC Basic doubt - Registration with "subform"?
I’m working on my first ASP.MVC project with C# and I’m playing with student registration. On the student registration page there is a Checkbox that when marked (I imagined) should enable the…
asp.net-mvcasked 7 years, 3 months ago AlamBique 533 -
2
votes2
answers1697
viewsDate range C#
I have a table in the bank called Quota, this quota has two columns one for data_start and data_end, so far so good, now I have another table called Order that also has data_start and data_end,…
-
2
votes1
answer639
viewsHow to pass parameter to a Controller constructor?
How can I inject a parameter into my Controller constructor? I have the CategoriasController with a builder waiting for the IAppServiceCategories appService, When I call a mistake returns to me.…
asp.net-mvcasked 7 years, 3 months ago Marco Souza 12,304 -
2
votes1
answer59
viewsIt is possible to know in which Routes. Map() the call of an Action fell? ASP.NET MVC5
Afterward of that question I was wondering, is it possible to know on which route map my Action used? Example: I have two routes.MapRoute() routes.MapRoute( "Home", "Image/{id}", new { controller =…
-
2
votes1
answer24
viewsHow do I make an IF and disable a field using script
I’d like some help, wanted to do an IF to disable or enable a field that comes with the value 1 or 0. $(document).ready(function () { $("#btnProduto").click(function () { $.ajax({ type: "POST", url:…