Questions tagged as 'asp.net-mvc'

1
answer

Hide a column from a WebGrid

Good afternoon. I have a WebGrid and would like to leave a column invisible. How could I do that? This is the grid: @{ Layout = null; WebGrid grid = new WebGrid(Model); } @grid.GetHtml(columns: new [] { grid.Column("ID_PARAMETER"), gri...
asked by 18.05.2015 / 17:29
1
answer

Why use IEnumerable?

I have the following code in a Controller: var carro = new List<SelectListItem> { new SelectListItem {Text = "Pegeout", Value = "Pegeout"}, new SelectListItem {Text = "Chevrolet", Value = "Chevrolet...
asked by 15.05.2015 / 03:34
2
answers

Is it feasible to use more than one DbContext for the same database?

I'm developing a new application in ASP.NET MVC and searching I've seen some examples of applications with more than one context. Let's say my application has several different modules, but all entities have some connection. In this...
asked by 09.03.2015 / 21:07
1
answer

Code First Table Migration - N for N using Fluent API

I have the following classes: [Table("Area_Cursos_Turma")] public class Turma { public int TurmaID { get; set; } public virtual ICollection<Aluno> Alunos { get; set; } } [Table("Area_Cursos_Aluno")] public class Aluno { publ...
asked by 26.09.2014 / 14:06
1
answer

How to internationalize Enum values?

I have the following code in the Model: public enum Lista { [Display(Name = "Lista_regular", ResourceType = typeof(Mensagem))] Regular = 0, [Display(Name = "Lista_irregular", ResourceType = typeof(Mensagem))] Irregular = 1 }...
asked by 17.04.2014 / 04:06
1
answer

Partial does not render

I have a problem with my application. What happens is that I am not able to render a partial in another view. Here is the partial code: @model CEF01.Models.Ocorrencia @using (Html.BeginCollectionItem("Ocorrencia")) { @Html.HiddenFor(mo...
asked by 15.05.2014 / 01:54
1
answer

Error while mounting HTML table with jQuery

I need to create this screen: TheproblemisthatthecodeIhavegeneratedgenerates9columnsinarowinsteadofgenerating3columnsperline: Thisisthecode:@{ViewBag.Title="Home Page"; } <div class="col-md-12"> <table id="tblQuadro" class="tab...
asked by 28.12.2018 / 14:41
1
answer

How to check if an email was sent successfully?

I am trying to verify that an email sent from my application is sent successfully, wondering if the recipient receives it or not (full mailbox, invalid email, there). For what I researched, there is deliverynotificationoptions that the ga...
asked by 28.07.2014 / 10:59
1
answer

Read CSV file without saving it

I have following code: [HttpPost] public ActionResult importCSV(HttpPostedFileBase file) { if (file.ContentLength <= 0) { ViewBag.Message = "Nenhum arquivo foi enviado.";...
asked by 09.06.2015 / 16:32
1
answer

How to save and return images with Web Api?

How to send and return images of a Web Api from Controller of a Asp.net MVC application? In my Controller of project Asp.net MVC I get from View an image of type HttpPostedFileBase and need to...
asked by 06.06.2014 / 21:37