Questions tagged as 'razor'

1
answer

How to validate start date and end date for a same attribute of Model

Problem description: I need to create a form with a start date and end date to list the sales of a product by period. Let's take this model as an example: public class Produto { [Display(Name = "ID")] public int IdProduto { get;...
asked by 26.09.2014 / 16:23
1
answer

DataAnnotation validating property with Javascript plugin. ASP.NET MVC

I need to validate a field in my model that has a text editor in Javascript . So far so good, because the problem only occurs in the registry that I do not get in the Action parameter "Create" an object, but a FormCollection . In the...
asked by 16.07.2014 / 05:41
1
answer

Helper to write HtmlHelpers

I'm trying to write an HtmlHelper and seeing some basic examples I found one with the class TagBuilder already help : namespace MyNamespace { public static class MyHeleprs { public static MvcHtmlString Image(t...
asked by 02.07.2014 / 22:55
1
answer

Render pages within _Layout.cshtml of other types. Asp.Net MVC 4

I'm basically developing a kind of social network, however I'm having some problems rendering pages within my _Layout.cshtml page. Html <ul class="dropdown-menu"> <li class="header">Você tem @pUser.RequestsToAccept.Co...
asked by 21.05.2014 / 22:11
2
answers

Insert checkbox dynamically by Json return does not display Text?

I am creating a list of Checkbox according to the selection of a Select on the same screen. In the event change of select is called via ajax javascript , the method that returns a Json with list (valu...
asked by 14.01.2017 / 22:09
1
answer

What are the good points of using View Engine Aspx instead of Razor?

When I search on ASP.Net MVC , I always find all examples of views with Razor (I do not remember exactly if I saw any in aspx) and in the past I remember that I could select this View Engine when creating a new one web applic...
asked by 05.03.2015 / 18:03
1
answer

Send only list object that has changed to the controller

I have a view that lists all my clients . Each client has 3 checkbox where the user selects the same, and sends to controller - through the button (submit) - the data to change. The method is working perfectly. However, whe...
asked by 22.07.2015 / 16:52
3
answers

How to check if a specific value exists (string) in a list in C #?

I'm trying to set up an input select multiple and leave checked the options that are already present in a certain list. I'm a beginner in C # so the logic of what I need would be something like this: (Note that I'm using Razor) Sorry for...
asked by 14.02.2014 / 14:56
1
answer

Razor C # make list and sublist with ListString (originally "how to check if an HTML element already exists")

I need to know if an HTML element already exists, in my loop, if it exists I use it, if it does not exist I'll create one. How would you do this within a @foreach (var item in Model){ ... } Following the comment of Gypsy, as it is not po...
asked by 13.05.2015 / 01:28
1
answer

How to get the path of a file (HttpPostedFileBase)?

I would like to get the path from where my file is coming from. Model: [Required(ErrorMessage = "Selecione o arquivo a ser importado.")] [Display(Name = "Arquivo ")] public HttpPostedFileBase Arquivo { get; set; } View: @Ht...
asked by 26.10.2015 / 19:46