Questions tagged as 'asp.net-mvc'

1
answer

Object reference not set to an instance of an object - MVC

I am loading a table, and doing debugging, it brings the data back perfectly, but when I get the data from the reference table in the foreign key, it is returning the following error:    NullReferenceException: Object reference not set to an...
asked by 15.08.2018 / 22:10
1
answer

Could not load type 'ProjectName.MvcApplication' when duplicating project

I duplicated my project in Visual Studio as follows: 1 ° I entered the file system and gave CTRL C + V to the folder SiteTeste which is the project folder. 2 ° I renamed the folder to Siteteste2 and then renamed the fi...
asked by 24.07.2018 / 22:25
1
answer

SQL Server Sum Sum Error on DAO Layer

I'm trying to show the result of SUM in the DAO layer, the query after the expected result, but in the field where the sum is shown, does not show an error. A procedure in Sql Server ALTER PROCEDURE [dbo].[RelatorioDcv] @dateInicio date, @d...
asked by 21.08.2018 / 16:56
1
answer

Prevent duplicate registration with C #

I'm having difficulties with registration in duplicity. How do I make the data after the user fill out the form at the time of saving the data compared to the one in the database, if it has any repeated field it does not save the form data?...
asked by 30.07.2018 / 21:46
1
answer

How to make this FOR (in C #) list only the top five items?

I have an ordered list, that I need to display only the first 5 items, not all the bank records, so I'm not getting it. Here is my code as it is: public class DashboardController : Controller { private NFeWebContext db = new NFeWeb...
asked by 28.05.2018 / 16:00
1
answer

Problems with javascript in ASP.Net applications MVC - Minification failed

I just uploaded my system to the server, so I went to do the first tests and this is causing the following errors in my Javascript scripts /* Minification failed. Returning unminified contents. (1,1): run-time error CSS1019: Unexpected token,...
asked by 11.07.2018 / 22:22
1
answer

Error trying to create a Controller or ApiController

I created an empty Asp.Net Core 2.0 project (without scaffold). Model DDD and etc. But when I try to create my controller, it is inherited from ApiController or Controller, it gives error:    Controller is a namespace, but is used as a type...
asked by 18.06.2018 / 16:56
2
answers

Back to previous page - mvc page razor

I'm trying to get back to the previous page, like this: string urlAnterior = Request.Headers["Referer"].ToString(); if (urlAnterior.Contains("Pagina")) return RedirectToAction(""); else return RedirectT...
asked by 03.07.2018 / 16:56
1
answer

Call action with button click passing parameter

I will have 3 buttons, each with a different id, how do I pass this id to the action of my controller when it is clicked? public IActionResult Index(int id) { var lista = _listaService.sites(id); return View(lista); }...
asked by 21.09.2018 / 02:28
2
answers

Select field with first blank item

I use select and it is populated from the database: <select asp-for="CategoriaID" asp-items="@Model.CountryList" id="cbcategoria" class="form-control"> </select> And here's how it's in the controll...
asked by 24.09.2018 / 15:46