Most voted "razor" questions
With ASP.NET Razor we have the possibility to insert the application logic directly into the project view layer, for example, it is possible to insert the Razor syntax along with the HTML codes within the same page
Learn more…370 questions
Sort by count of
-
1
votes1
answer67
viewsHow to load a Partialview to create a comment
I am working on a project to learn ASP.NET MVC and Razor. Right now I have a model of post with a view, and a view associated with model class comment to create a new comment. I wanted to know how…
-
1
votes2
answers26
viewsHide in an Actionlink, is it possible?
I’d like to depending on my condition ActionLink was visible or not. Razor: <td> @Html.ActionLink("Cadastrar site","MontarFancyCadastrarSite", "ItemOS", new {ChaveOS = Model.ChaveOS }, new {…
-
1
votes1
answer97
viewsMVC 5 Ajax.Actionlink returns result, but does not render in DOM
Gentlemen, I’m having trouble displaying a list of results in my view. The idea is, by clicking on a dropdown value, I make an asynchronous query to popular the next dropdown. I refer to the…
-
1
votes1
answer678
viewsValidation for Textarea using Razor MVC 4
I have the following modal and need to include validations so that the textarea is mandatory when clicking the "Yes" button, that is, it cannot be sent in white, and so that the textarea has at…
-
1
votes1
answer50
viewsWhat a good practice for using Modelbinders in MVC
I’m looking to create a page using best practices in ASP.NET MVC. I was in doubt what would be the best practice for me to model my page using modelbinders to "bindar" my object automatically. In…
-
1
votes1
answer613
viewsJavascript load Partialview passing a Model
I need to call a Partialview in my Javascript but I’m not sure how. I’m using a plugin that in the TARGET variable gets a Div. And this in my case, this Div I put being a Partial View. My JS is like…
-
1
votes1
answer192
viewsHow to make two Radiobuttons enable and disable fields
Each radio button enables and disables two fields, two by two. When the first radio is clicked the first two textBox are enabled and the last two are disabled. When you click on the second radio…
-
1
votes1
answer294
viewsDisplay Name with Razor
I have this case in my project? public enum TipoValorCalculoComissao { [Display(Name = "Percentual")] Percentual = 1, [Display(Name = "Valor")] Valor = 2 } And I would like to put these values in a…
-
1
votes1
answer20
viewsVariable content is not displayed in the View
Instead of displaying the value of item.Endereco in Webgrid what is displayed is a text @item.Endereco.Length > 0 ? item.Endereco.Substring(0, item.Endereco.Length - 3) item: item.. In my current…
-
1
votes1
answer1478
views@Html.Dropdownlistfor how to set the default value
I need to set the default value displayed by a @Html.DropDownListFor Researching found: @Html.Dropdownlistfor how to set default value So I did it in my code: @Html.DropDownListFor(model =>…
-
1
votes1
answer187
viewsProblem running method to insert new User using ASP.NET MVC with HTML and RAZOR
I have a problem running a request to enter a new user, I do not know what I need to do now to finalize my request, By clicking the sign up button nothing happens below are my HTML code and the…
-
1
votes0
answers97
views -
1
votes1
answer73
viewsUse of Eval to transform Razor to Javascript
Before criticizing the use of eval, I read and recommend that answer. Take into account the following context: Code C# (Razor): var teste = new { prop1 = 123, prop2 = "minha mãe disse 'Háaaaaa!'" };…
-
1
votes1
answer83
viewsInsert data into db sql server
I’m having problems connecting my project to the database, I do not understand the reason, I’ve looked at several tutorials, use sql server 2017, I can access db in an application, but the site is…
-
1
votes1
answer458
viewsPartialview relationships Asp.net mvc 5
I’m having trouble creating the logic of registering models that has relationship between them. One exists only the reference, but in the other the reference is of type List<>. I created a…
-
1
votes3
answers5808
viewsProblem running Visual studio debugger
I have a problem in my project, I use ASP.NET MVC 5 and for a while I get this message whenever I run my project, the problem is not the visual studio installed on the machine(as in that solution)…
-
1
votes2
answers77
viewsdistinct use in a dropdownlist
I’m trying to get equal names off my dropdownlist, but they’re different id’s. I wanted where I would have to implant the code if it would be in the view, or in the controller somewhere else. Data…
-
1
votes1
answer327
viewsHow to clear a @Html.Textboxfor using Javascript?
I am trying to clear the value entered in the field of TextBoxFor the following form just after Submit. @BHS_Treinamento.WebApi.Models.Curso @{ ViewBag.Title = "Cadastrar"; }…
-
1
votes2
answers116
viewsHide Menu tab
I am trying to hide the Nav menu bar when it enters a specific form, would be to give some example? This is the index of my form: @using PagedList.Mvc; @model…
-
1
votes1
answer83
viewsAdd Dropdownlist value to the database
I wanted to put a dropdownlist in my view where his List value went to the database, but I only know how to add values to DropDownlist with data from a table, wanted to make a DropDownlist with…
-
1
votes2
answers1870
viewsHow to pass input value via post on Asp.net core Razor
I would like to know how to pass the entered value in an input to a Post method in Pagemodel. In cshtml: <div class="col-sm-6"> <label asp-for="Tickets.Identificador"…
-
1
votes2
answers661
viewsBack to previous page - mvc page Razor
I’m trying to get back to the previous page this way: string urlAnterior = Request.Headers["Referer"].ToString(); if (urlAnterior.Contains("Pagina")) return RedirectToAction(""); else return…
-
1
votes2
answers23
viewsChanging the Button Source
Guys wanted to know how I could make my button not turn purple because of the hyperlink. I wanted to leave in this appearance the button more or less. Code: <button class="button">…
-
1
votes0
answers79
viewsASP Net MVC - Insert html helper into string and render via Html.Raw
Fala galera, I have the following situation: I have a list of links registered in the database, which will be loaded according to the user’s profile. I’m currently obligated to do so:…
-
1
votes0
answers263
viewsReturning Error View after calling a Modal pop up
Hello, I have a problem with the front end of my application. I have the following method to return errors: public class ErrorController : Controller { //Erro 500 Servidor public ActionResult…
-
1
votes0
answers112
viewsHow to use more than 1 'div Asp-validation-Summary' in the same Razor view?
I have a Razor view that has two different forms, one of Login and the other of User Registration, I built both forms and I inserted as usual the tag with asp-validation-summary <div…
-
1
votes2
answers517
viewsPass parameters through the url
I’m trying to pass a parameter of my view to my controller by the url and I’m not getting it, as you can see in the code below I’m using viewbag, I don’t know if it’s an error on the route or…
-
1
votes1
answer39
viewsRelated entity on page Razor
I have a problem on a page Razor, I have a "Person" entity that has a relationship with the entity "Address" public class Pessoa { public int Id {get; set;} public string Nome {get; set;} public…
-
1
votes3
answers157
viewsWhy doesn’t View see the javascript file?
How to make the view run the javascript file: novo.js Directory structure: Views > Product > js > new.js Error: View Product.cshtml: @{ ViewBag.Title = "Index"; } <h2>Index</h2>…
-
1
votes3
answers132
viewsChoose Modal from variable
I am giving the value to a variable string in my index.Cs file and then I am taking the value to use in Typescript, however I am creating another page besides index now and is giving error when I…
-
1
votes1
answer100
viewsError while trying to render a partial view in a view
I have a View(cshtml) and I need to call a partialView. This Partial is a table with the logs of that Sale, which will be viewed in tabular format at the bottom of the View. The problem is that when…
-
1
votes1
answer26
viewsdropdow list MVC, with selected item
I have a dropdowlist that carries RamosDeAtidade, want to know how I do to my Edit view, already be selected the branch I registered, in my Controller, at Action Edit It’s like this: var cliente =…
-
1
votes1
answer32
viewsblank option @htm.Enumdropdownlistfor MVC5
I’m having a problem in my Razor, I want the option that comes selected is a blank. my Razor is like this: @Html.EnumDropDownListFor(m => m.Endereco.Zona, string.Empty ,new { @class =…
-
1
votes1
answer31
viewsCall action after a notification
On my index I have this @foreach (var item in Model) { @Html.HiddenFor(modelItem => item.id_regional) <tr> <td> @Html.DisplayFor(modelItem => item.ds_regional) </td>…
-
1
votes1
answer66
viewsDefault value in Select List . net Core 2.2
In my system I have a select which returns the recorded data in your database table, the problem is that the list already starts with the first record automatically, and I need her to return a…
-
1
votes1
answer268
viewsRegistration with Modal and Partialview . Net Core 2.2
In my project I created a button for registration, which calls a modal that is inside a PartialView. The objective is to register through this modal the data informed in the database, the problem…
-
1
votes1
answer37
viewsAccess time c# and show in Alert
I am trying to display a message according to the return of my method, which is a Task<ActionResult> , but when I call the TempData, she’s coming empty, where I’m erring? @section scripts {…
-
1
votes0
answers44
viewsFull Description for a flag in a List/Ienumerable in C# Asp Net MVC
I have a list of records, where I have a Status (STS_BANCO) with values (A of Active and I of Inactive, P awaiting approval, and N analyze, among others ) where in the table I recorded "A,I,N,P",…
-
1
votes1
answer237
viewsHow to insert values that have "," as decimal separator?
Hello, I am making a product registration using . Net Core 3.1 and I have the following problem: In the product register there is a field to insert the value of the product, however when inserting a…
-
1
votes0
answers67
viewsBlazor | Service Registration Error - Microsoft.AspNetCore.Components.WebAssembly.Rendering.Webassemblyraddress[100]
Hello, I’m taking the first steps on Blazor and following an example I saw on the internet, which makes the Load Menu and Submenu straight from the data bank, I’m having problem at compilation time:…
-
1
votes1
answer64
viewsHow do I not need to request the api all the time?
I’m a beginner in development. net core and I am developing an application that consumes data from an api and shows to users, but I need to update the site all the time and it takes a little time.…
-
1
votes1
answer117
viewsProblem to fill date field with ASP.NET MVC, Razor
I’m making a mini registration system, it has the place to edit a client’s registration, when I click edit it comes the data in the fields for me to edit, all fields comes normal, except the field…
-
1
votes0
answers28
viewsHow to pass the id date to the controller without allowing the user to do screen manipulation?
Knob: <a id="btnExcluir" type="button" class="btn btn-icon-toggle" data-toggle="tooltip" data-placement="top" data-original-title="@UtilResources.VIEW_TEXTO_EXCLUIR_REGISTRO"…
-
0
votes1
answer274
viewsHow to concatenate Radiobuttons values into Razor/HTML?
I have a question and it’s kind of hard to find a practical way to solve. I created a groupbox with 10 radiobuttons. I would like to know the best practice so that when the user marks one of them I…
-
0
votes1
answer298
viewsRazor - @Html.Dropdownlist with dynamic name
I would like to concatenate the ID I get from @Model in the property string name of the Dropdownlist, because I would like to treat them dynamically. I try to do @Html.Dropdownlist("Name" +…
-
0
votes1
answer505
viewsIs it possible to use Razor inside Javascript file?
I have a file .js and would like to use the syntax of Razor within it. I tried to simply use the @ but it didn’t work. Is there any possibility? Can anyone help me? I’ve done a lot of research, but…
-
0
votes2
answers1976
viewsHow to pass a variable in a Javascript function by the onclick Razor?
I have a series of fields I need to send from tag Razor for a function JavaScript @Html.ActionLink("Enviar", "ActionName", null, new { onclick = String.Format("envia_pessoa({0}, '{1}', '{2}', '{3}',…
-
0
votes1
answer563
viewsHow to pick up Radiobuttonfor value through Formcollection and save to SQL Server BD
I have a model with several booleans, I need to take their values through a Formcollection and save in the SQL database (does not accept Boolean, so the field is as bit). My View: <div…
-
0
votes1
answer144
viewsJquery - For loop inside a DIV
You guys, good morning. Simple: I’m giving a For a div: <div class="Laço"> <div class="ItemLaco"></div> <div class="ItemLaco"></div> <div…
-
0
votes2
answers494
viewsSave data group in Post method
I’m using the Begincollectionitem to save a list of data in my add method. For that, I created a ViewModel with the main data to the list I want to save, in the method POST. I own the ViewModel…