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
-
0
votes1
answer663
viewspass actionlink parameters to jquery function
How would I pass parameters from an Actionlink of a grid to a jquery function? This is the Actionlink: gridPortfolio.Column( format: @<text> @Html.ActionLink("Delete", "DeleteData", new {id =…
-
0
votes1
answer1306
viewsDisplay or Hide Fields for Natural or Legal Persons
I have a form that registers Clients, and has the option of being an Individual or Legal Person, and each one has some different fields. I thought of using a @Html.Radiobutton with the option…
-
0
votes1
answer901
viewsUpdate a viewbag (c# Razor) with a javascript variable
Maybe what I want to do may be impossible, because of server and browser side issues, but I would like to do the following: <script> function pegarId(id) { $('@ViewBag.Id').value =…
-
0
votes1
answer201
viewsASP.NET Form MVC 5 cannot access Model properties
I am starting at ASP.NET MVC, following tutorials and handouts on the internet I created a study project and I have some doubts. Well, first I’ll create a class structure to follow: > Acesso…
-
0
votes0
answers53
viewserror running view Asp.net mvc
When running the project and calling the view is returning me the following error: The view at '~/Views/Produto/List.cshtml' must derive from WebViewPage, or WebViewPage<TModel>. View code:…
-
0
votes1
answer101
viewsPartial is not rendered
Accordingly this link from another question of mine that ended up generating error where I followed the steps referring to another question, I am experiencing a rather strange error. I created a…
-
0
votes1
answer85
viewsProblem with AJAX
I am developing a site in ASP.NET MVC, I wanted that when I changed screen only be updated my div .ESTRUTURA here is the code: Javascript: function loadPage(page) { $.ajax({ type: 'GET', url: page,…
-
0
votes2
answers7710
viewsUnable to locate Data Provider . Requested Net Framework. Sql Server + Entity
I’m having trouble connecting with my local bank. This is my View, where I try to connect the bank using Razor: @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_LayoutOuvinte.cshtml"; var db =…
-
0
votes1
answer190
viewsShow content in textboxfor
I would like to know how to display the value of a property within a textboxfor. I have the following code: @model Calcular.Models.Conta @{ ViewBag.Title = "Somar"; } <h2>Somar</h2>…
-
0
votes1
answer177
viewsLog in with the Facebook user
How do I do a c# or Razor routine on my site, so instead of the guy just by logging in the page, have the option to log in by the facebook user? I’m not asking for code ready, just how I do it.…
-
0
votes0
answers475
viewsError in @Scripts.Render("")
I cannot render bootstrap, scripts and etc, because mine @Scripts.Render and @Styles.Render doesn’t work. The reference System.Web.Optmization is included in the project. See the image with the…
-
0
votes1
answer195
viewsDynamically hide a Webgrid column
How can I hide at runtime a column from Webgrid ? For example, I want to hide the column Parametro, it would be something like that: grid.Column("Empresa", "Empresa"), if(item.valor1 == X){…
-
0
votes0
answers346
viewsHow to click on a map an address from a form?
How to show on the map the address of one of a form ? <table> <tr> <td> @Html.Label("Cep: ") <br /> @Html.TextBoxFor(e => e.CEP, new { maxlength = "9", id = "Cep", name =…
-
0
votes1
answer293
viewsHow to order dropdownlist?
How can I order the Dropdownlist? <div class="form-group"> @Html.LabelFor(model => model.id_pessoa, "Pessoa", htmlAttributes: new { @class = "control-label col-md-2" }) <div…
asp.net-mvc asp.net-mvc-5 bootstrap-3 razor dropdownlistasked 7 years, 5 months ago Marcos Rebitte 9 -
0
votes2
answers347
viewsHow do I make my Dropdownlistfor equal to Select
How do I leave my Dropdownlistfor, like this select where the first field cannot be selected. <select> <option value="0" selected disabled>Selecionar</option> <option…
-
0
votes2
answers114
viewsHow to receive information in a View?
I programmed my controller as follows: [HttpPost] public ActionResult Login(string pUsuario, string pSenha) { usuario oUsuario = modelOff.usuarios.Where(p => p.usuario1 == pUsuario &&…
-
0
votes1
answer29
viewsCan I set up an upload page, which can receive photos, video and zip packages containing photos and/or videos?
I am like an application where the registered user has a page of uploads of images and videos and I wanted to know if there is how, in addition to receiving photos and videos by uploads, if I can…
-
0
votes0
answers263
viewsDoubt in html. Viewbag-powered dropdownlist
I’m having the following problem: I need to send instead of the Id of ViewBag, the Municipio, which is contained in ViewBag.Cidades. How Do I Switch from Id to Municipio when I click Search to send…
-
0
votes1
answer104
viewsHow to use C# syntax in onclick
I declared a variable in view: @{ int index = 0; } And I want to change it through a onclick: @for (var b = 0; b < cont; b++) { <li> <a onclick="@(Index = b)">Endereço @(b +…
-
0
votes1
answer23
viewsFor with Datetime in Razor giving out of memory Exception
I am having out of memory error, being it caused by this Razor code in my cshtml file, and can’t identify where the problem is. @for(DateTime data = DateTime.Today.Date; data <=…
-
0
votes2
answers158
viewsHow do I correct this error, and was able to see this other table in my view?
I need to make a select with two tables and play the result for a PagedList. But when I query, returns the error: Cannot implicitly Convert type 'Pagedlist.Ipagedlist' to…
-
0
votes1
answer767
viewsHow to validate if there is an upload file?
I have a form for uploading files: @using (Html.BeginForm("importCSV", "Administrador", FormMethod.Post, new { @id = "upldFrm", @enctype = "multipart/form-data" })) { <div class="form-inline">…
-
0
votes2
answers133
viewsRemove from mvc page " 2017 - Project Name"
I have an Razor page that I call inside another page, and because I have this identification: 2017 - Cronoparque, appears twice on the "same page", since I call one, inside the other, I would like…
-
0
votes1
answer37
viewsAdd Class Dropdownlistfor
How do I enter @class = "form-control" in the code below? <div class="form-group"> <label for="disabledSelect" class="control-label col-md-2">Status:</label> <div…
-
0
votes1
answer156
viewsError showing accent words in View
Good afternoon, All words that have accent on my system are being formatted wrong as in the example below: Auto de Inspe¿¿¿o Where it was to be auto inspection. How to solve this, knowing that I am…
-
0
votes0
answers92
viewsHow You Configure Checkboxes Materialize Css in Asp.Net MVC Web Application
How do I set up Checkboxes in the Asp.Net MVC Razor Since in the documentation we have the following configuration Materialize for checkboxes <p> <label> <input type="checkbox" />…
-
0
votes0
answers261
viewsrzc generate exited with code -2147450749
I am starting a new application and when I have buildar of this error... someone there could give me a help ? i just put a new html code. Version of dotnet: Error presented: rzc generate exited with…
-
0
votes1
answer35
viewsCapture checkboxes marked in a View
I’m listing my objects through a ViewBag sent to the View, and for each item there is a checkbox, and for each contract there is an Id: @foreach (var item in ViewBag.Contratos) { <tr>…
-
0
votes1
answer113
viewsWhat is the difference [email protected] vs 'Asp-controller' next to 'Asp-action'?
I am doing a project in ASP.NET MVC and I came up with this question, The Url.Action in a 'tag' (for example in a navbar) can redirect the page passing the method and controller as parameter.…
-
0
votes1
answer49
viewsHow to format number string with . net core?
I need to format this number string, which is returned from an api: As I wish: 83,951,583. Página Razor: <h3>Mundo</h3> <div class="card bg-primary text-white mb-3" style="max-width:…
-
0
votes0
answers16
viewsPublication Razor ASP . NET MVC with problem
When I publish my web application in IIS via Visual Studio Community 2019, direct from my workstation, at the moment I access it through the browser of the attached message. But when I delete the…
-
0
votes1
answer1371
viewscheckbox + Model + Controller. How to pick up selected rows?
I’m sent to my model typed for a view and loaded the data into a table where I enclose a checkbox for each line. The user will select the items that matter to be later saved in the database. My…
-
0
votes1
answer102
viewsDatatable does not sort the field when changed the value locally
Good morning guys, I’m using Datatable to sort, but when I change the value locally of the status and without posting on the page Datatable seems to ignore my change and sort all the others but what…
-
0
votes1
answer52
viewsCatch <a> tag click event when it hasn’t loaded yet in $(Document). ready MVC - RAZOR
I create dynamically in my View via Razor data that is populated in a table. On my last td I have the following elements: <td class="row-actions fixed-col"><a name="excFaturamento"><i…
-
0
votes1
answer48
viewsWhen I press enter in input type file, it opens a blank page
This is my code, when pressing enter it opens a blank page <div class="form-group"> <div class="col-sm-12"> <div id="fileselection" style="margin-bottom:30px"> @using…
-
0
votes3
answers805
viewsPicking text from a particular column with jquery
Good afternoon. I need to take the value of one DropDownList in a given table column. This would be the table: @model IEnumerable<Santander.Web.MVC.ValidacaoGanhadores.Models.Ganhadores>…
-
0
votes2
answers1031
viewsHow to call an Html.Action("my page") via jquery?
I have a page that loads several partials views, I want to call in a modal a specific page that will fill the entire screen. I am using a generic jquery command to call an action that will be passed…
-
0
votes1
answer37
viewsShow elements according to click
In my view I have 5 partials that should be rendered. I needed that when clicking one is shown and the others are hidden... Is in this structure: <ul class="nav nav-tabs"> <li…
-
0
votes1
answer52
viewsShow Datareader return date in View?
I have a form where I have at View: <div class="col-md-2 form-group"> @Html.LabelFor(x => x.CLIENTEDESDE) @Html.TextBoxFor(x => x.CLIENTEDESDE, new { @class = "form-control", type =…
-
0
votes1
answer202
viewsError rendering Partialview in a View
I have a View and within it I want to render a Partialview. What happens is that the partial is of a model different but that has relationship between them. I want to show a partial as if it were…
-
0
votes0
answers677
viewsDropdownlist with data from an Enum
I need to make a Helper where I pass an Enum and it mounts a Dropdownlist based on all values of Enum, I tried to do as follows: C#: public static HtmlString DropDownListEnumFor(this HtmlHelper…
-
0
votes1
answer893
viewshow to get the value of a specific checkbox in Asp.net mvc using Jquery
I have a table on an ASP.NET MVC system that each record has a checkbox, here’s the code below the view: <table class="table table-hover table-striped" id="tabelaProdutos"> <thead>…
-
0
votes2
answers97
viewsElement Span at the front
I have the following column of a table: <td style="font-size:10%"> <p class="list-group-item-text"> <a href="@Url.Action("Cidade", "Cidade", new { cidadecod = item.cidadecod,…
-
0
votes2
answers41
viewsAction that returns Partialview is not being called
I need to present a list of results according to the form below, but the research is not presenting the result. To action in controller is not being triggered. @using (Html.BeginForm()) { <div…
-
0
votes1
answer134
viewsForeach on Razor with Many to Many Relationship Model in Entity Framework Core
I have a table of funcionário and a table of projeto related to many to many as shows diagram below: At the controller FuncionariosController in the method Detalhes i want to list the list of…
-
0
votes1
answer854
viewsAsp.net MVC cshtml Divs layout alignment?
Good afternoon! Dear friends, I am a beginner in the area of development and I have a small doubt. I have an ASP.Net MVC 5 project, where I have a layout inserted in my master page in…
-
0
votes0
answers408
viewsTwo Dropdowlist ASP.NET MVC 5 filter
I would like to make a filter with two DropDownList. In the first filter are filtered the registered Units and in the second the Functions registered in that unit, with their respective Employees.…
-
0
votes1
answer156
viewsHow to send Partialview input to a controller?
I tried to find something that would take away this doubt, but there’s nothing concrete for what I want. I’m using Visual Studio 2015 and MVC 5 and Razor in my project. I have a form (Create) with a…
-
0
votes2
answers409
viewsPass List to Actionresult
Briefly: I have a screen with a table populated by the list below, where I select the line through checkbox, I need to pass this list to my actionResult. As I do not have a form on this screen I can…
-
0
votes1
answer455
viewsPass Viewmodel properties to Controller
I put my table inside a BeginForm passing my controller and my action, but when I give Submit the fields are NULL in the controller, I don’t think this passing the properties of Viewmodel. @model…