Questions tagged as 'razor'

1
answer

Why @ Html.CheckBoxFor returns "true, false"

In the construction of my View, I have a field of type: public bool? RegistoGesOleos { get; set; } What I represent using Razor as: @Html.CheckBoxFor(model => model.RegistoGesOleos.Value) Now when I do submit of my Form, and...
asked by 27.10.2014 / 16:09
2
answers

Hide different actions for different user profiles

I am in a project where I have 3 different levels of profiles: Administrator , Teacher and Coordinator . I already have the login module, registers and such. What happens is that I wanted for each profile type to appear only what is allowe...
asked by 25.05.2014 / 03:15
2
answers

Receive int nullable in Razor (@ Html.TextboxFor)

I have a Carro object and I have an integer and nullable property called AnoInspecao . When creating, I can create a car object with the null inspection year (without typing anything) and persist in the database normally. var carro = ne...
asked by 03.12.2015 / 18:44
2
answers

HTML element within an ActionLink

Hello, I would like to know if you can create an HTML element within a ActionLink , for example: To create a link on a menu with ActionLink : @Html.ActionLink("Classificação Financeira", "Index", "ClassificacaoFinanceira") Bu...
asked by 06.10.2015 / 16:34
2
answers

Only parameterless constructors and initializers are supported in LINQ to Entities - Asp.Net MVC

I'm developing an application that manages courses. The student, when entering the inscription screen and clicking on the "enrollment" button, is associated to a course, that is, is enrolled. So far so good, only when I try to check if he is alr...
asked by 06.06.2015 / 18:17
1
answer

Database changes with ASP.NET MVC 5

I'm starting some independent projects using ASP.NET MVC 5 with Entity Framework, and more learning from technology. And at the moment I had a great doubt. I used the generated code through a connection to the database, creating an ADO.NET En...
asked by 02.09.2014 / 03:12
1
answer

Validate maximum size of an attachment

Good afternoon guys, I need to validate the maximum size of an attachment but my code is not working, can you help me? Follow the code below: HTML: @using (Html.BeginForm("AdicionarAnexo", "Turma", FormMethod.Post, new { @...
asked by 20.11.2015 / 18:24
1
answer

How to use session for authentication in MVC 4 with C #?

My scenario is as follows. I have an MVC 4 application. On my controller I check the logged in user and password. (I think) I put user data in a session after the data is verified and correct. My pages are cshtml (Razor). And I have a master...
asked by 02.07.2014 / 23:50
1
answer

Error in using ViewBag in DropDownListFor ASP NET MVC

I have a DropDown that lists the categories of my system, plus when I submit the form without choosing a category, it gives a server error saying that the value can not be null. I put a validation with the ValidationMessageFor, but anyway it doe...
asked by 26.09.2015 / 03:18
1
answer

Send "@ Html.BeginForm" to controller from another area. Asp.Net

I have a controller in a Area named " LoginProfessional ", with actions Index, Logon, Logoff . I make a RenderPage by calling Index in the Area root of the project, however when I click the button it...
asked by 15.05.2014 / 19:11