Questions tagged as 'asp.net-mvc'

1
answer

ViewBag does not receive the value correctly

I'm trying to pass a value from Controller to View , here's how it's in View: <div class="alert alert-danger alert-dismissable" role="alert" id="alerta"> <button type="button" class="close" data-dismiss="alert" aria-l...
asked by 20.12.2018 / 14:36
1
answer

If else of date

I have a viewbag, and wanted to display dates of at most 1 day before the current day, I made the code below, but without success, what alternative would I have? if (item.DataHora < DateTime.Now - 1) { //codigo }     
asked by 01.11.2016 / 05:09
2
answers

How do I make a foreach within the View in a ViewData

These are my ViewData in controller: public ActionResult Acao() { RupturaEntities db = new RupturaEntities(); var _listaUnidade = Enumerable.Empty<object>(); var _listaFamilia = Enumerable.E...
asked by 19.09.2014 / 15:57
1
answer

Change date display format in View

I have the following field that returns me the date as follows: 09/17/2018 11:52 AM How to put it within the default pt. I already tried to put .ToString("dd/MM//yyyy") in model.dtProtoclo but it did not work. <div class="f...
asked by 17.09.2018 / 16:55
1
answer

Show fk name on the grid

This is the select of my proc select f.id ,f.nome ,f.dataNascimento ,f.cpf ,f.cidade ,c.nome from funcionarios f inner join cidade c on f.cidade...
asked by 10.08.2018 / 15:25
1
answer

Location.href is not transferring from page in ASP.NET MVC

I'm doing a login screen in ASP.NET MVC. The framework makes all processes complete without errors: go to the database, query the login and return with an OK (user exists, I can authenticate). When the flow returns from the bank and passes throu...
asked by 18.08.2016 / 04:16
1
answer

Error: The model item passed to the dictionary is of type X but this dictionary requires a model item of type Y

It is giving error when starting the query and in the generation of the list with the results: Error:    System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Linq.Enumerable + WhereSelectEnumerable...
asked by 02.02.2018 / 20:27
1
answer

Field NullableDateTime 01/01/0001 [closed]

I have a Model field [Column("sdt_dataPagamento")] [Display(Name = "Dt. Pagamento")] [DataType(DataType.Date)] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")] public DateTime? DataPagamento { get; set; } I...
asked by 20.04.2016 / 19:19
2
answers

Problems with ASP.NET MVC

Has anyone ever had an error like this? View Index Code: @model SPTC.NIE.SPG.Application.ViewModels.UsuarioViewModel @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") &...
asked by 04.11.2016 / 17:36
1
answer

How to Register a date in my Database using ASP.NET MVC [closed]

Let's suppose I want to register an item in my database. Knowing my item name and price. But I want to also when registering the item should also register the date. How do I do this? I am still new to Asp.net Mvc MODEL public class TABLE...
asked by 19.07.2017 / 20:59