Questions tagged as 'razor'

1
answer

MVC - Create a typed model being a generic list

I would like to create a typed Model with it being a list of type T . Using: ASP.NET MVC 5 Razor For example: My model in cshtml will look like this: @model List<T> @foreach (var item in Model) { <h1>@item.nam...
asked by 23.06.2017 / 03:03
2
answers

What are the model and model variables in a View?

What are the @model and Model variables in a view ? In my view I use this at the beginning of the code: @using Html5DataList.Models @model List<Estabelecimento> And to access the data, I use it like this: @foreac...
asked by 29.07.2017 / 15:45
1
answer

How to pass parameter via button

How do I use the text of @Html.TextBox("pesquisa") as a parameter in the code below <button id="BtnConsulta" onclick="location.href='@Url.Action("Pesquisa", "Cliente", new { PARAMETRO)'"><i class="glyphicon glyphicon-search">...
asked by 22.10.2015 / 02:16
3
answers

How to use the @Html.RadioButton, how to send the select option to the controller?

I'm trying to send the selected RadioButton option to the controller, I've already tried to do it in several ways, I've researched in several places and I do not have a solution. Thank you Index @model List<SistemaMobile.Models.cli...
asked by 07.04.2015 / 20:34
1
answer

Datetime-local at @ Html.EditorFor

I have a model property that I'll save DateTime : [DataType(DataType.DateTime)] [DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:yyyy-MM-ddThh:mm:ssZ}")] public DateTime DataInicio { get; set; } I want to convert t...
asked by 19.07.2016 / 16:11
2
answers

Display dynamic images using Razor

Hello, I'm having trouble displaying dynamic images using Razor syntax in an ASP.NET MVC 5 project. I have the image path saved in a column in the database, named Image . Below the code for my view: @foreach (var item in Model) { <d...
asked by 29.12.2014 / 00:22
2
answers

How to use Resources in .js file?

I have an Asp.Net MVC project where I am using Resources , and to use it on my web pages p> @using projeto.Translations <h3>@Resources.DISPLAY_OLA</h3> The problem is that I have some items (buttons, for example) that are d...
asked by 24.07.2015 / 13:26
1
answer

Choose which items from an enumerator appear in an EnumDropDownListFor

Is there a way to select only a few items from the enumerator to send to a EnumDropDownListFor ? For example: public enum Documento { CPF = 1, RG = 2, CNPJ= 3 NASCIMENTO = 4 } And I would like that in a given View...
asked by 29.10.2015 / 17:01
1
answer

I can not implement an @Foreach in MVC

I am a beginner in ASP.NET MVC development and need some help. I can not create a Foreach . Below is my code. @foreach (var item in Model.Fornecedores) { <tr> <td> @Html.DisplayFor(modelItem => mod...
asked by 01.09.2015 / 15:12
2
answers

How to make a button with Razor and Css

I'm trying to make a button on a particular page. However, my entire project started with the Razor engine, so I would like to know how I can make a button with such an engine, I'm trying to do it like this: @model WebApplication3.Models.Co...
asked by 23.10.2016 / 19:10