Questions tagged as 'asp.net-mvc'

1
answer

DropDownList filled in and selected

I need to fill in a @Html.DropDownList () with the parameters of my Model and pre select one of the items. In the Model I'm getting the complete package, being: Product list in Produto and items selected through MotivosRel . M...
asked by 17.03.2017 / 14:12
1
answer

Download View instead of displaying it

Is there any way to instead of returning a view and displaying it on the screen for the user, I return it but instead of displaying it I save the .html file on the computer? The code is as follows: return View("~/Views/Item/Item.cshtml", model...
asked by 09.03.2017 / 20:31
1
answer

Validating dates

I'm doing a ExcelToEntityList function, that is, importing Excel data into a list, but I need to validate the start and end dates. Am I doing it right? The function: public List<ProdutosConfiguracaoTaxas> ExcelToEntityList...
asked by 17.02.2017 / 13:18
1
answer

ASP NET MVC with JQuery

I made an ajax request, but it does not call the controller, when debugging javascript never drops in success and the console appears Error processing XML. Controller: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Cadastro(Pedid...
asked by 30.03.2017 / 19:48
2
answers

What is the difference between public async System.Threading.Tasks.TaskActionResult Index () and public ActionResult Index ()? [duplicate]

Follow the code: Example 1: public async System.Threading.Tasks.Task<ActionResult> Index() { return View(); } Example 2: public ActionResult Index() { return View(); } Please explain the difference between the 2 in as...
asked by 07.01.2017 / 01:00
1
answer

Insert data with related objects

I'm trying to insert an containing object that has a relationship. User > Company First of all I need to get the UserID data in the% Create % public ActionResult Create() { var usuarioLogado = User.Identity.Name; var usuario...
asked by 10.01.2017 / 22:25
1
answer

PagedList: Data Paging with Ajax

I'm using PagedList with Ajax, but I'm not getting a page change because when I click the button that represents the page, the value that is going to the controller is null. I made the following structure: View: @model PagedList.IPagedList&...
asked by 18.12.2016 / 01:23
1
answer

Could not load file or assembly 'EntityFramework, Version = 5.0.0.0 or one of its dependencies

I would like to know if someone could help me with this error, as I am trying to enable Migrations in a project and this error appears at the time of giving the enable-migrations command in the manager console of visual studio packages....
asked by 21.01.2017 / 00:19
1
answer

How to return warning in a View if there is no data to display?

I've created the code below that generates a list. The same check whether the list contains any data recorded in it or not. If it has data, it returns a View with the list inside, if it does not have data, it returns null . How to do, i...
asked by 22.06.2017 / 22:53
1
answer

Find information in the database in one row of SQL code per logged-in user

I've been able to fetch all dates from the database. However, I would like to search through a specific ID that is logged into the system. Per session, in case. But this code is giving error in the part where I put the HttpContext. Any suggestio...
asked by 19.11.2016 / 17:56