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
votes3
answers783
viewsHow to return values from two different tables?
I’m working on a script for auto complete that you should search two tables of the same level (Courses and Packages) (without relation) and return the merged values in a single list. The problem is…
-
2
votes1
answer923
viewsGenerate dynamic HTML with ASP.NET
Good people, I have a project, and I need to generate a card with dynamic HTML, pulling from an sql server. The case is as follows, I have an html CARD, all stylized. Which in this case is the code…
-
2
votes2
answers77
viewsDoubt with registry edition Asp.net mvc
I have the structure: Page where I select the record for editing: @if (Model.Count() > 0) { foreach (var item in Model) { <tr> <td>@item.NOME</td>…
asp.net-mvcasked 8 years, 5 months ago Harry 3,805 -
2
votes1
answer487
viewsHow to create master-detail form using a Viewmodel
I have a viewmodel in my project. Within it I have two entities that are a list of items. I’m doing the data editing logic of these entities that are inside the viewmodel. I have 5 entities in all.…
-
2
votes1
answer579
viewsHow to store passwords in environment variables (and remove them from version control)?
I’m migrating from a local tfs to a private git (probably bitbucket). Today I simply encrypt webconfig, now I will have to take my sensitive data out of version control (Connection string,…
-
2
votes1
answer925
viewsDate-place on @Html.Editorfor
I have a model property that I will keep DateTime: [DataType(DataType.DateTime)] [DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:yyyy-MM-ddThh:mm:ssZ}")] public DateTime…
-
2
votes2
answers800
viewsBundle doesn’t work when I publish the site
I’m using the BundleConfig.cs in my project to reference the JS and CSS libraries. Below are examples: bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(…
asp.net-mvcasked 8 years, 4 months ago Carlos Henrique Biazin Esteves 299 -
2
votes1
answer213
viewsSet up MVC route
Inside the Controller folder of my MVC project I created a subfolder called Entries, which contains within 1 controller called Entries (home page of the registration module) and the other…
asp.net-mvcasked 8 years, 4 months ago Carlos Henrique Biazin Esteves 299 -
2
votes2
answers223
views@Html.Checkboxfor Works on GET, but not on POST
I have the following model: public class MEUViewModel { public List<Obj1> Obj1s { get; set; } public List<Obj2> Obj2s { get; set; } public int IDMeu { get; set; } public int IDMeu2 {…
-
2
votes1
answer226
viewsMVC - Store user permissions in session using NLB - Network Load Balancing
We are developing an application (intranet) in MVC 4 where authentication is performed through Windows Authentication. When the user enters the application, a call is made to a service that controls…
-
2
votes1
answer229
viewsRedirect with MVC Timer
I have a little problem I’m cracking my head to solve. I am building an MVC website and would like to make a opening page with Timer rolling like this image: So far, great. The problem is that I…
-
2
votes1
answer174
viewsNull value is going to the ajax error function - ASP.NET MVC
I am developing a ZIP consultation page where sending and feedback information is done in ajax: $.ajax({ url: "@Url.Action("PesquisarCEP", "CEP")" + "?cep" + retirarMascara($("#dsCEP").val()), type:…
-
2
votes2
answers488
viewsWeb Paging with C#
I’m building an administrative application, and in this application I have a message page. I am currently bringing the last 20 messages. I already have the screen ready to receive this messages, but…
-
2
votes1
answer79
viewsNull 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 its label. Below is an example of how it is being displayed today: The attribute Dating null came, so it…
-
2
votes1
answer100
viewsPre-filled model returns null in Httppost
I’m building a page in the ASP.NET project where I have a model that contains 2 lists, which I fill one initially at get and then direct to the View where I fill another list, but when receiving…
-
2
votes2
answers85
viewsModeling of Models 1 to n
I’m modeling a system for academies. I created 2 models, Modality public class Modalidade { [Key] public int ModalidadeId { get; set; } [MaxLength(200)] public string Nome { get; set; }…
-
2
votes2
answers461
viewsResult automatic calculation javascript Asp.net mvc
I was able to sum two fields using Java Script, but the result only displayed by clicking on the result field, I would like to display the result automatically, without having to click on anything.…
-
2
votes1
answer89
viewsValidation Issues Upload Multiple Javascript Files
In the form, in an Input by selecting multiple images @using (Html.BeginForm("Edit", "RoomType", FormMethod.Post, new { enctype = "multipart/form-data", onSubmit = "return ValidateImagesUpload()"…
-
2
votes1
answer100
viewsAsp.net MVC does not recognize dates in dd/mm/yyyy received via GET
I am making a filter for a paged list. The values of this filter should be sent via ajax with Verb GET. This is the model: public class FiltroViewModel { public DateTime? CriadosDe { get;set; }…
-
2
votes1
answer136
viewsSearch the Mysql MVC database
I have a Search which searches by name, but wanted it to search both by name and by place in the same research field. Follow the action: [HttpPost] public ActionResult Search(FormCollection fc,…
-
2
votes0
answers243
viewsBeginform makes GET instead of POST
I have a controller that has two actions; public ActionResult Cadastrar() { return View(); } //[ValidateAntiForgeryToken] [HttpPost] public ActionResult Cadastrar(Usuario usuario) { if…
-
2
votes0
answers545
viewsMVC - Display messages from the controller
Within my MVC application we have several situations where, depending on the business rules of the function, several messages should be displayed to the user. We are currently using the Jquery…
asp.net-mvcasked 8 years, 1 month ago Carlos Henrique Biazin Esteves 299 -
2
votes1
answer1196
viewsRedirect to a controller in another Area
I looked for a solution to this but could not, I’m trying to redirect session errors to login, my application is inside a folder called Areas and when he saw something redirect to him I redirect so…
-
2
votes2
answers441
viewsSystem.Data.Sqlclient.Sqlexception: Conversion failed when Converting the varchar value to int
I’m getting this Exception in c# when I try to read SQL data. I’m wondering if this error is a problem with my SQL or C#. My SQL code that makes the conversion is this: `$ (SELECT ORDEM FROM TABELA…
-
2
votes1
answer80
viewsUse Separate Date Time
I have a Datahora field and wanted to use it separately, that is, a single field in the database called Datahora of the datetime type, and manipulate this field with two editorfor where I save the…
-
2
votes2
answers147
viewsHow do I migrate Code First without deleting data from the table attribute?
I need to change the attribute name of Heaviness for Pesoproduct, this is the code that is generated after executing the command add-Migration: namespace Web.Dominio.Migrations { using System; using…
-
2
votes1
answer791
viewsCSS configuration for matrix printer
Well, my problem is this. I’m developing a web system and I use ASP.NET MVC, I managed to generate a guide where the layout that I present is null. But I couldn’t set up the print correctly for a…
-
2
votes0
answers450
viewsStandard for the use of logs
I have a project organized as follows: 1. Web (ASP.NET MVC) 2. Application 3. Domain 4. Infra.Data 5. Infra.Log (NLog) 6. Infra.IoC The project references are as follows: - Web --> Application -…
-
2
votes2
answers55
viewsHow to know that called the screen
I have two screens List and Filter, both are redirected to a third screen called Visualise: Button View from the screen List: //ABRE TELA VISUALIZAR $(document).on('click', '.visualizar',…
-
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
votes2
answers2823
viewsGeneric error Undefined object reference for an object instance
I already searched the whole forum and did not find an error that matches mine. If anyone can help me. I am with this error: Error: Object reference not defined for an instance of a object. Linha 1:…
asp.net-mvcasked 8 years ago Mario Antonio Pagnozzi 31 -
2
votes2
answers210
viewsEntity Framework 6: Provider Error
I am using EF6 Code First. While performing "Update-Database" the database is normally created. But when entering the data the following error is launched: No Entity Framework Provider found for the…
-
2
votes2
answers244
viewsRemove Arrows from Editorfor
I created my class with the guy int [Required(ErrorMessage = "Preencha o Numero")] [DisplayName("Numero")] public int Number { get; set; } and so on Layout generated these little arrows, how do I…
-
2
votes1
answer135
viewsError while logging in applications
Well, here’s the scenario: Have 2 applications ASP.NET MVC on the same project, which are using a Dominio in common. I’ll call it MVC1 and MVC2 to get better at exemplification. I installed the…
-
2
votes1
answer145
viewsError opening Package Manage Console
When I open the Package Manage Console give me the following message: Join-Path : Cannot Convert 'System.Object[]' to the type 'System.String' required by Parameter 'Childpath'. Specified method is…
-
2
votes0
answers492
viewsUnable to start program 'C: Program Files (x86) IIS Express iisexpress.exe'
My visual studio from night to day started to give an error when starting the application, this error only happens the first time I start the application (Asp.net mvc 4), in other times iis starts…
c# asp.net-mvc visual-studio visual-studio-2015 asp.net-mvc-4asked 7 years, 10 months ago Daniel Aragão 36 -
2
votes1
answer1460
viewsHow to use Ajax with Antiforgerytoken?
Follows the code: //AntiForgeryToken function gettoken() { var token = '@Html.AntiForgeryToken()'; token = $(token).val(); return token; } Ajax and formData: var formData = new FormData(); var file…
-
2
votes1
answer133
viewsPut variables in the URL in MVC to use with JS
I have a search page that will fetch the results using ajax. Do the searches you do, the URL is always the same, because the page does not change. Is there any way I can change the URL also when I…
-
2
votes1
answer241
viewsRollback transaction does not work as expected
I’ve recently been implementing a sequence of requests in Visual Basics, and would like to give a rollback when any fail. So I did it this way: Public Class DAO Dim connection As New MysqlConnection…
-
2
votes2
answers2474
viewsHow to use Chart.Js with ASP.NET MVC
Well, I’m returning a list of and sending to View. And I need to implement this through a chart with Chart.js. I have the class Parents: [Table("Pais")] public class Pais { [Key] public Guid PaisId…
-
2
votes0
answers105
viewsdatepicker loses formatting and mouse icons
Personal I am implemented the Datepicker with date and time (standard en) I’m using the component that’s on this link: http://eonasdan.github.io/bootstrap-datetimepicker/ Reading the manual I used…
-
2
votes1
answer108
viewsError while logging in using Facebook
Trying to login through facebook I come across the following error: Server Error in Application '/'. Undefined object reference for an object instance. Description: An untreated exception occurred…
-
2
votes1
answer625
viewsGet specific login data through facebook
I am seeking to implement authentication through the facebook. Where I want to get more data audiences. I already have the default authentication set up. But I need something else, because it only…
-
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
answer1551
viewsThere is no Viewdata item of type 'Ienumerable' that has the key 'Categories'
I have a problem with dropdownlist. I populated it with information that was on my DB. Code of controller: public ActionResult NovoProduto() { ViewBag.categorias = new SelectList(db.Categoria,…
-
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
answers306
viewsAny ASP.NET MVC solution for SQL injection?
I have in the application a code that validates the data entry, adjusting according to what is necessary, this would be considered a good or a bad option? public static string ValidaDados(string…
-
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
votes3
answers554
viewsUsing the Case When Then command with Entity Framework
I have the following structure corresponding to a table in my database: Cat_Codigo, Cat_Descricao, Cat_Observacao, Cat_Status Where the Cat_Status is defined by 0 or 1, with 0 -> Deactivative and…
-
2
votes1
answer262
viewsControllercontext Null
I have the following code: PDFController Ctrl = new PDFController(); byte[] ArquivoPDF = Ctrl.GerarPDF(xml); This part above is in the Webapi, where I create a new instance of the Controller to use…