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
votes2
answers222
viewsCreating a collection
The two images are as mine array is. In the first image I have an array with 3 items, being the first of the month of April and contains 4 passages. For each passage I have the respective…
-
1
votes1
answer112
viewsAjaxbeginform replace does not work
I’m using a Ajax.BeginForm to update a specific div on the page. When performing Submit and executing the action, instead of updating this DIV, the page is updated with the partial view returned…
-
1
votes2
answers1083
viewsLoad a type list into a View of another type
I’m doing a professional registration and of course, my View is typed with this Model. But in the register I need to insert Specialization and Type (other 2 different models). These last 2 models…
-
1
votes1
answer470
viewsRadio button using Viewdata for a MVC model
I own a Viewdata and would like to turn it into a Radiobutton for a model ViewData["tiposPagamento"] = dbo.TiposPagamento.Where(_=>_.Ativo); Radio Button :…
-
1
votes1
answer2499
viewsHow to call controller action?
I have the following code: function confirmaExclusao() { var decisao = confirm("Deseja excluir permanentemente esse item?"); if(decisao == true) { //Chamar a action para excluir } else { //Aqui não…
-
1
votes1
answer77
viewsHow to get user type in view?
I have an Asp.Net MVC project that uses Individual User Account with Owin. Everything is working perfectly, but I would like to get user type (role) in View. I’m using Request.IsAuthenticated to…
asp.net-mvc razor authentication asp.net-identity owinasked 9 years, 5 months ago Jedaias Rodrigues 6,718 -
1
votes1
answer306
viewsUrl.Action with routevalues and objects
I have the following Url.Action: @Url.Action("ActionName", "ControllerName", new { area = "AreaName" }) I also need to send some objects to this action through this Url.Action, how could I do that?…
-
1
votes2
answers1937
viewsHow to render html by passing as a controller string to the view?
I have the following view: public ActionResult RelatorioEquipe() { ViewRelatorioEquipeDTO dto = new ViewRelatorioEquipeDTO(); dto.LstUnidadeGerencial = negocio.Relatorio.ObterLstUg();…
-
1
votes1
answer955
viewsHow to use Url.Action in a Razor Helper?
In an ASP.NET MVC5 project, I created a Helper inside the briefcase App_Code, however, when using the function Url.Action() in my Helper the following build error occurs: CS0103: The name 'Url' does…
-
1
votes2
answers97
viewsTag HTML in Helper Razor
I have HTML code: <label class="labelinput">Nº Compra<em>*</em></label> Passing to the Helper was as follows: @Html.Label("Nº Compra:", new {@class = "labelinput"}) But I…
-
1
votes3
answers821
viewsRazor - Send parameters to a Bootstrap modal
I have a list (grid) and want to open a modal bootstrap with details of the chosen line. To build the list I’m using - @foreach, and store the data in a viewbag. The idea is to open the modal window…
-
1
votes1
answer340
viewsError in foreach
Good evening guys. I have a project for a school that registers the student’s data and their occurrences. going straight to my problem: What happens is that I have a page to show the new occurrences…
-
1
votes2
answers157
viewsAdd @onchange to Editorfor using Razor
Hi, I’m trying to add @onchange to my EditorFor, Yeah, I’m gonna have to add that field dynamically CURRENT LINE @Html.EditorFor(model => model.CEP, new { @class = "classe" }, new { @onchange =…
-
1
votes1
answer72
viewsHow to build a list in Controller and mount a Dropdownlist
I have the following difficulty. My class addresses have the TipoEndereco, wanted to mount a dropdownlist Shall I set up a list on the controller? I got her in the view? Thank you.…
-
1
votes1
answer609
viewsUpdate modal content dynamically
I have a table with up to 10 services listed, and each row has a refresh button. By clicking the refresh button, a modal window opens with the data of this line, as well as a form for change.…
-
1
votes1
answer233
viewsUpload _Layout.cshtml information from database
I want to upload the information to _Layout.cshtml as registered in the database, for example, @ViewBag.MetaDescription, @ViewBag.MetaKeywords, @ViewBag.Title and other information also from the…
asp.net-mvc asp.net-mvc-5 razor entity-framework-6asked 8 years, 6 months ago Alexandre Rodrigues Alves 11 -
1
votes0
answers463
viewsUse two CSS classes in C# Razor MVC
I want to use two CSS classes in Razor. Is it possible to do this? Because I’m not getting it. Here’s what I’m doing: <div class="form-group"> @Html.LabelFor(model => model.ativo,…
-
1
votes1
answer287
viewsMVC Helper Menu
I’m having some difficulty in assembling a Helper to assemble the system menu This is my view @model…
-
1
votes0
answers49
viewsLink sends null array
I have a search screen and need to send a parameter as array, this part was quiet, the big problem is that this screen is paged, so in the page change links I put to send this parameter, but it is…
-
1
votes1
answer787
viewsHTML Tags for Razor Engine (Asp.net mvc C#)
I’m having difficulty in my web application with Asp.net mvc, of how to create forms using the Razor Engine. Below follows my HTML code. <form class="o-form" method="post"> <input…
-
1
votes1
answer344
viewsHierarchical Object Filter
I have an Asp.net MVC 4.5 C# Razor screen typed by a main class: public class ClassePaiDTO { public virtual ICollection<Filho1DTO> Filho1s { get; set; } public virtual…
-
1
votes1
answer29
viewsDisplay an Enumdropdownlistfor as a condition
How to present a EnumDropDownListFor as a condition? For example, if the user wishes to inform his or her sexual orientation Enum is presented. Otherwise it is not presented.…
-
1
votes1
answer595
viewsRecover property of Object Anonymous C# Razor
I am working with MVC4 and Restsharp for data access via API Rest, My return is an object of the type Object but I cannot recover a specific property of this object. How can I access the property?…
-
1
votes2
answers724
viewsRazor in javascript file
I have a little code that works on _Layout: $.ajax({ type: "POST", url: "@Url.Action("Action", "Controller")", success: function () { //Seu código aqui ... } }); So far, so good, only _Layout is…
-
1
votes1
answer283
viewsCharacter limiter in ASP.NET text-box
I’m trying to implement a character limiter for this text-box, but I have no idea how to do that. It is an insertion page of posts in a portal and the title needs to have a limit. <div…
-
1
votes1
answer2211
viewsDifference between @Html.Labelfor and @Html.Displaynamefor
I am starting at ASP.NET MVC and taking a course where the teacher used to display the data of a different class methods to display a given. He uses the @Html.LabelFor and the @Html.DisplayNameFor.…
-
1
votes1
answer357
viewsWhat is "Asp-fallback" for in ASP.NET MVC, Razor Pages?
I see some files like lines similar to this: <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js" asp-fallback-src="~/lib/jquery/dist/jquery.min.js"…
-
1
votes0
answers110
viewsASP.NET MVC - Changing input to dropdown and popular with SQL Server table values
I have a partial view (in this case, one of those Razor Pages) of type "Create" created from a table in SQL Server (which is stored as an entity of a model in my application). @model…
-
1
votes1
answer1927
viewsDisplay the return of a query with 2 tables in the same View in ASP.NET MVC
Controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using HelloMobile.Models; namespace HelloMobile.Controllers { public class…
-
1
votes0
answers74
viewsI can’t use two models in one with cshtml
I need to load a dropdown, but the dropdown data comes from one model and cshtml is from another model. So I created a model that was common to both of us and I decided on this model, the two models…
-
1
votes0
answers37
viewsHow to put images in the select tag in Asp-net core?
<select> <option background="https://lipis.github.io/flag-icon-css/flags/4x3/gb.svg">gb</option> <option…
-
1
votes1
answer41
viewsSearch using 2 types of info in the same text field!
I’m trying a filter with Razor, search in the same text field, 2 information, you can type CNPJ or wallet, when I load the requests page, already loads with the data of CNPJ and Wallet on the…
-
1
votes0
answers89
viewsas it is possible after the user is dropped from the system by inactivity, the same return to the same screen that was after login
As I am new and I am learning mvc, I would like to know, as it is possible after the user is dropped from the system by inactivity, the same go back to the same screen that was. I know the code…
-
1
votes0
answers7
viewsHow to place a Raddiobutton as Checked on the Razor Page
I have the following question, I want to leave this radiobutton as checked, but it is not checked, I tried to put checked(true), but it does not work, follow the code: @Html.Radiobuttonfor(m =>…
-
1
votes1
answer379
viewsView Popup asking for authentication when you click on a screen component that you are not allowed to change
How to create a mechanism for when the user clicks to try to change a date that is like datepicker and display a popup for authentication or something like that to make that change? If he has…
-
1
votes1
answer141
viewsrecover data from a view table in the controller
I have a table that is generated in the View dynamically. From the moment the user selects the products in another table, I need to recover in controller all the ids and quantities of products that…
-
1
votes2
answers296
viewsvalidation for Partialview
I have a page that calls a partialview formed by a div with text field inside it, through a button. Each time the button is pressed a line is added. The problem is that I cannot validate the empty…
-
1
votes2
answers1501
viewsDropdown Menu ASP.NET MVC 5
I need to change the menu to apply a Dropdownlist, but I’m having difficulty. I’m following the footsteps of the bootstrap site, but when click does not appear the submenu, follow the code below:…
-
1
votes1
answer291
viewsHow to pass ID via Javascript to a View
In the application I am developing use Views of the type modal. Use this code to display the modal: <button class="btn btn-default details" data-id="@clientes.Codigo"><i class="glyphicon…
-
1
votes2
answers2016
viewsSending Model to Controller via Ajax
I have a strongly typed View with a small form and a javascript function with ajax: function emitir () { $.ajax({ type: "POST", traditional: true, url: '@Url.Action("EmissaoRapida", "CND")', data: {…
-
1
votes1
answer220
viewsCarrregar view table with JSON object
I have the following code in my controller: public JsonResult List(string nome){ IList<ClienteDto> clientes = string.IsNullOrEmpty(nome) ? _repositoryCliente.Get() :…
-
1
votes2
answers320
views@Html.Dropdownlistfor Default item at first list values
Good afternoon, gentlemen. I use DropDownListFor To load lists, example load all my clients to be selected. However, I need that if a record does not appear in the listing have the option to add a…
-
1
votes1
answer414
viewsForm validation ASP.net mvc!
I have a form that validates the fields when trying to send information, only I have a "novapagina" option where I would not like to validate the fields, this would be possible? In the views <div…
-
1
votes1
answer176
viewsHTML5 rendering with Razor
According to W3schools an input has no tag closure ex <input type="text" name="firstname" value="Mickey"> source: http://www.w3schools.com/html/html_forms.asp In my ASP.NET MVC project I have…
-
1
votes2
answers137
viewsGetting registration id
I have a table with multiple records and a link to delete, how do I click this link to pass the id value of the record I want to delete ? Code from my view: @model…
-
1
votes1
answer97
viewsHighlighting does not work in Razor MVC 5 views
I’m with a Razor ASP.NET MVC 5 project that was created on VS2013 on another computer. Loading it on my computer with VS2012 Highlighting and Views Intellisense (cshtml) does not work. I realized…
-
1
votes2
answers672
viewsHow to pass a Ienumerable Model to a Controller?
I have a page that correctly lists my records. Plus I have a Html.BeginForm for each line, @model IEnumerable<Generico.Dominio.TB_POSSIBILIDADE> @{ ViewBag.Title = ""; } @if (Model.Count()…
-
1
votes1
answer355
viewsDoubt : Search with Dropdownlist mvc 4 Razor Asp.net C# sql Server
I’m having difficulty in popular dropdown with sql server, because it comes repeated sql item ... ex: when I select cities it comes with repeated cities and so on, and I can’t direct to search page.…
-
1
votes1
answer376
viewsHow much to use @Html.Actionlink or Javascript
I’m having trouble understanding when to use a @Html.ActionLink or javascript:document.getElementById('Comercial').submit() For example: <a><i class="fa fa-home"></i> Home <span…
-
1
votes1
answer395
viewsHow to fill in an Editorfor as the login user name
I have a View, where the user must fill in some fields, and has a last field that I left him disable, and would like that in this field appears the name of the user, but how do I fill? Model: public…