Questions tagged as 'asp.net-mvc'

1
answer

How to use the C # syntax in 'onclick'

I declared a variable in view : @{ int index = 0; } And I want to change it through onclick : @for (var b = 0; b < cont; b++) { <li> <a onclick="@(Index = b)">End...
asked by 09.01.2018 / 12:44
1
answer

My _Layout.cshtml file is not being recognized in the application, what to do?

I'm doing an application in MVC asp.net, and out of nowhere my application no longer recognizes the layout file no longer applying the bootstrap and jquery ... How can I solve this ?? My layout file looks like this: <!DOCTYPE html>...
asked by 26.01.2018 / 11:04
1
answer

How to read a JSON file using C #?

I have my code that reads an external API and returns me information, I would like to read this information or add it to a class: I'm using Newtonsoft.Json; This is Json: { "success": true, "errorMessage": null,...
asked by 06.12.2017 / 13:21
1
answer

Does not display data on Api web screen asp.net mvc

I started to study a little web api using with asp.net, I am doing a very simple example where I just want to list the data of the employee table, but I get error: No MediaTypeFormatter is available to read an object of type 'IEnumerable'1' fro...
asked by 02.03.2018 / 00:57
2
answers

Convert DataTable to List C #

I need to convert the contents of DataTable to List , I'm new to C # and I do not know the syntax. public List < VoCliente > ConsutaCliente() { DataTable tabela = BDOracleCliente.ConsultaCliente(); List < VoCliente >...
asked by 07.11.2017 / 13:24
1
answer

Using SQL Query with Asp MVC5

How do I execute a SQL query with ASP MVC5 + Entity? To create the MVC I used the entity's own option (I created the model, context) and already generated the controller and the views Follow the controller code: using System; usi...
asked by 15.01.2018 / 18:50
2
answers

Error in IEnumerable [closed]

using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; namespace Rotas.Models { public class Noticia { public class Noticia { public...
asked by 28.08.2017 / 14:43
1
answer

Error saving to bank

I would like some help. When I try to save the registry, the following message appears:    23502: null value in column "id" violates not-null constraint The primary keys are not autoincrement, I'm using a function that generate the pri...
asked by 30.08.2017 / 16:27
2
answers

Solution C # MVC does not execute JavaScript in IIS

I have a C # solution where I use MVC. In it I have a View for inclusion of product items. In this view I have a DropList as specified below: Drop List <div class="form-group"> @Html.LabelFor(model => model.ProdutoId, "Prod...
asked by 11.10.2017 / 19:26
1
answer

How to change the column name of a table using the Add-Migration Code First command Asp.Net MVC

I have a table already created and I want to change the name of the column without it being deleted, since it already has a lot of information. I did the procedure to rename the Street to Address property in the class and after I ran the Add...
asked by 15.10.2017 / 14:41