Questions tagged as 'razor'

3
answers

How to create razor dropdownlist in .net mvc via ajax?

I would like to dynamically load my dropdownlist without submitting the page! my project is in .net mvc! architecture @Html.Label("Categoria do Veiculo: ") @Html.DropDownListFor(v => v.CodigoCategoriaVeiculo,Model.TipoModeloEquipamento...
asked by 20.02.2015 / 20:32
1
answer

Form using BeginCollectionItem gets null viewModel in foreach

I want to make a form where I can register multiple addresses and phones for a single person, and I want to be able to do this when I am registering the person. Based on the answers to my other question , I came to the part where I put te...
asked by 13.08.2015 / 19:41
2
answers

null check returns reference error

Model public class Transacao { [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int ID { get; set; } [Required] public DateTime Data { get; set; } [Required] public decimal Valor { get; set; } }...
asked by 14.05.2014 / 20:40
3
answers

Pass ViewBag to _Layout

I need to pass a list to my layout where it is used on all my pages, would you like to know how I could do this?     
asked by 11.06.2015 / 15:20
1
answer

C # Decimal field accept value equal to or greater than 0 in validation

I'm having problems validating my fields of type decimal using Razor, when I try to enter 0 in the field it gives the following error message.    The field XXXX must be a number. Below is my class and how I enter the field with Raz...
asked by 15.12.2017 / 14:31
1
answer

Form with two destinations

I have the following form: @using (Ajax.BeginForm("minhaAction", "meuController", new AjaxOptions() { HttpMethod = "POST", OnFailure = "alert('Erro!')", OnSuccess = "TrabalharResultado" }, new { id = "meuForm"...
asked by 26.08.2015 / 19:56
2
answers

View control in Partial View conditionally

I need a Partial View control to be displayed according to a condition. For some views a button would appear for others not and this would be set via a parameter in the Partial View call. After searching I saw that I can use ViewDataD...
asked by 09.04.2015 / 04:04
2
answers

Pass values from one form to one method in Model and return the result to another textbox on the Form

I have a very simple form with 3 textbox and a button. I would like to get the value of the first two textbox by clicking the button and move to a method present in my model and after that return that result to the third textbox . I'm havin...
asked by 20.03.2015 / 15:52
1
answer

Multiple select list with items already selected using Razor

I'm using Razor to generate a SelectList like this: @Html.DropDownList("StatusImovel", new SelectList(ViewBag.ListaStatus, "IdStatus", "Descricao"), new { @hidden = "hidden", @multiple = "multiple", @form = "nulo" }) I need it...
asked by 03.01.2018 / 13:42
1
answer

DropDownListFor in a for

I am trying to fill a DropDownList with a selected value within a for , but it is not working properly. What happens is that when Action Index returns the model to View , values are not being selected, always being the...
asked by 29.12.2015 / 14:44