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
answer110
viewsIf Load javascript
I have a following script. It’s two checkboxes that will work like two radio Buttons, which happens to me, when I click on a checkbox it disables all the questions in the form and also disables the…
-
0
votes1
answer38
viewsIf using load
i have the following javascript function: $(document).ready(function () { Eventos(); $('[name="dtd1nrob"]').change(function () { BloquearQuestao(); }); }); function Eventos() {…
-
0
votes1
answer81
viewshttppostedfilebase null after reloading the page, (image upload)
Is there any way I won’t lose data from HttpPostedFileBase? my action makes a check, and in case of failure the page recharges with the image in the form and I have to make the call again, then…
-
0
votes1
answer72
viewsTable within the View
I’m placing a table inside the Edit view. View de Edit (Contract) @if (Model.ContratoParcela.Any()) { <table class="table parcela-lista"> @foreach (var parcela in Model.ContratoParcela) {…
-
0
votes1
answer326
viewsHow to use Validationmessagefor in Dropdownlistfor?
Please, can someone tell me how to use the @Html.Validationmessagefor for a @Html.Dropdownlistfor? Assuming the user has triggered the option to write from the system screen he should inform that…
-
0
votes0
answers97
viewsIf’s condition is not accepting in Asp.net mvc Razor
I want to update on one condition, however, you are updating the data without seeing the if condition using System; using System.Collections.Generic; using System.Linq; using System.Web; using…
-
0
votes1
answer283
viewsProblem with ASP.NET Checkbox "The Parameter Conversion from type 'System.String' to type 'System.Boolean' failed."
I’m having the following problem with a checkbox I have a checkbox list that is dynamically loaded (as the items that exist in the bank a checkbox is generated). I currently have only three items…
-
0
votes1
answer172
viewsError creating a condition in Webgrid’s Html.Raw
I am trying to put a condition in a Webgrid line and the following error occurs: Cannot convert lambda expression to type 'string' because it is not delegate type Even based on this post Variable…
-
0
votes0
answers17
viewsHow to leave a maskedbox
How do I leave values as real value, not a common number. I need these values to be as 2.00, if possible leaves R $ 2.00 My Controller: public ActionResult Adiciona(AbastecimentoModel viewModel) {…
-
0
votes0
answers131
viewsIs there a way to use CSHTML (Razor) in ASPX Webform projects?
I was taking a look in that question in Stackoverflow English, because I really find it very confusing to use ASPX files and find the syntax of Razor more user friendly. When trying to add a file…
-
0
votes0
answers50
viewsWrong binding in <select> ASP.NET MVC <option>
When I give a post in the form for the Controller, the Binding in asp-for="VehiclePlate" picks up the value of option of select (@vehicle.Category). However, I want to catch the text of option of…
-
0
votes0
answers45
viewsHow to apply the form input validation classes of bootstrap v4 with the ASP.NET Razor syntax?
Follows code: View: <div class="form-group"> @Html.LabelFor(m => m.Telefone, new { @class = "font-weight-bold" }) @Html.TextBoxFor(m => m.Telefone, new { @class = "form-control",…
-
0
votes1
answer218
viewsUpdate Dropdownlistfor in form
I have a form that has two @Html.Dropdownlistfor among other fields. However, when changing the first Dropdownlistfor I need to update the values of the other dropdownlist by passing its id as…
-
0
votes1
answer166
viewsProblem with form Ubmit
I’m having trouble trying to make a form Ubmit when my object is null as it is not required. However it is not possible to save with it null. /// Model public class Atividade { public virtual long…
-
0
votes1
answer53
viewsSource code for Helpers
Helpers source codes such as Textboxfor are available somewhere? I’ve found customizations like this: public static System.Web.Mvc.MvcHtmlString DtxTextBoxFor<TModel, TValue> (this…
-
0
votes1
answer606
viewsViewbag and Viewdata Doubt
I’m starting my career in development, and in the company project here, I found a ViewData being used, and for my researches I can not update it in a ActionResult in the controller. I ended up…
-
0
votes1
answer35
viewsASP.NET RAZOR - Project WEBSITE running on IIS (Approval or Production) does not include TAG HEAD
I have a problem in my WEB project , which when running by an IIS from a server, the tag html HEAD does not appear closed and when executed locally it appears correctly. Detail, when inspecting…
-
0
votes0
answers385
viewsHow to make Table with two foreach close <tr> </tr> Asp.Net MVC
I need to make a table that for each row I have the information as shown below See that in Lot 1 until City the data does not repeat at each foreach and only from the column Species the data…
-
0
votes1
answer53
viewsSave form Razor
How can I make my form not to sumbit the same form several times. I’m having this problem because some users are clicking save several times, not waiting for the screen update, so it is saving…
-
0
votes1
answer129
viewsGet Hidden value . net core
Good morning I have this Hidden that gets the value correctly: <input type="hidden" id="idHorario"/> But I need to get the Hidden in the code, how can I proceed? HorariosItens = await…
-
0
votes1
answer122
viewsHow do I perform select list list from the view for the Controller?
I have the following code in my view: @using (Html.BeginForm("DataAniv", "Mailing", FormMethod.Post)) { <div class="form-group"> <label for="sel1">Selecione o mês:</label>…
-
0
votes0
answers391
viewsAutomatic Text Break
I’m trying to remove the Line Break from this table, but I don’t know how to effect it, I wanted to let the full name be written and without the line break. Code: #customers { font-family:…
-
0
votes1
answer54
viewsValidate date in editfor
I made a date mask and would like to know, how I validate the date right there, IE, already in Edit he does not accept date like: 23/16/9087. This is my date editfor <div class="form-group">…
-
0
votes1
answer347
viewsRazor MVC - When using @using (Html.Beginform()) the fields are not in front of each other
I’m starting to study MVC + Razor and in example of basic CRUD, I’m trying to put the fields in two columns, as if I was using in HTML. But my code only works if I withdraw the @using…
-
0
votes2
answers305
viewsValidationresult with two parameters
I am trying to use custom validation as explained in this link, but then I can only pass one parameter to validate, and I need both, because if the field is empty and the other is false, it has to…
-
0
votes0
answers49
viewsLoad one tab into another
I have a layout page where I want to upload information to the notifications button. For this, I made an action in the controller to return a Partialview where a query will be made in the bd looking…
-
0
votes1
answer643
viewsHow to call a javascript function that is in a separate cshtml file (.js)?
Hello, I have a page where the data of a DropDownList are the result of the selection of a DropDownList previous to this, I created a function with javascript and ajax to realize the filter,…
-
0
votes1
answer256
viewsLoading from inside partialview js/css
Good morning,insira o código aqui I am unable to load . js/. css when loading the partialview in the layout <!DOCTYPE html> <html> <head> ... @RenderSection("header", required:…
-
0
votes3
answers799
viewsAligning Twiter bootstrap buttons inside a Table
My buttons inside the table are breaking the row when a column is added in the table, they are getting like this: My code ta as follows: <div class="row"> <div class="col-md-4"> @using…
-
0
votes1
answer266
viewsText field does not take Asp.net MVC value
I have a text field in my system called NomeEspecificacao, however when I fill any value in it, it is always returned null in my Action, ie never comes the word I write in the text field. View code:…
-
0
votes1
answer81
viewsExchange Html.Action() for an Ajax request
I have a method that returns a ActionResult called through a Html.Action() directly on View using Razor. This method is used to render a ComboBox of devExpress with the data I send a command SQL at…
-
0
votes0
answers46
viewsFind Javascript Function (onchange)
I have a question. I want to make a selections box depends on a page using Razor and javascript. TYPE, when selecting the community, the people corresponding to it have to appear. But I can’t call…
-
0
votes1
answer27
viewsDate field with wrong value
I have the date fields: @Html.EditorFor(model => model.DataInicio, new { htmlAttributes = new { @class = "form-control input-sm", @placeholder = "DD/MM/AAAA hh:mm" } }) @Html.EditorFor(model…
-
0
votes2
answers63
viewsHow can I make a "tender" expression in a simpler way
I don’t know a good way to ask this, I googled it but I didn’t think what I wanted, I know the expression variavel?.atributo which makes the code only try to catch the attribute if the variable has…
-
0
votes1
answer168
viewsChange View of Table
There is the possibility that I can create a menu, where I can choose which fields to show in my table? for example, I have a class with the following attributes: Name, Colour, Dating, Cpf, Rg, Id.…
-
0
votes0
answers45
viewssyntax pass value via post Razor Asp.net mvc
I’m trying to make a method to change via POST in my code and is giving syntax error, I do as follows: @Ajax.ActionLink(" ", "Usuario", new { item.CodigoUsuario }, new AjaxOptions { UpdateTargetId =…
-
0
votes1
answer28
viewsI am doing a search system in my movie view and gave an error regarding the Web request
(I decided to make another post, as advice of another user) In my Movies view there is a list of all the movies you have in the database and I added um botão, uma caixa de texto e 2 radio…
-
0
votes1
answer73
views -
0
votes0
answers42
viewsError clicking Header to order Datatable.js
I’m using the api Datatable.js and I’m going through the following problem: When I click on any coluna da table html to make the ordenação the entire content of the tag tbody remain only one line…
-
0
votes1
answer123
viewsMascara Doesn’t Work
my mask doesn’t work when I wear a variable. for example: Projeto.Aplicacao.ViewModel.Clientes.ClienteViewModel cliente = (Projeto.Aplicacao.ViewModel.Clientes.ClienteViewModel)(ViewBag.Clientes);…
-
0
votes0
answers58
viewsHow to pass 2 values from my dropdown
I’m trying to send 2 values returned from my dropdown for my action, but I’m not finding a solution. My dropdown lists the results of a query in the database and returns 2 values per item, I want to…
-
0
votes1
answer1235
viewsInput Mask Razor
I’m in need of help to include a CPF and CNPJ mask with Jquery or Js, so that it changes automatically after I click on a select, but I’m not able to include the mask inside the Razor I made.…
-
0
votes1
answer56
viewsFill Dropdownlist with Multiple Values
i am trying to fill a Dropdownlist that has multiple values, from my "Edit" action, where I recover the objects Toonmoves containing One or More Effects and how The Effects May belong to several…
-
0
votes1
answer11
viewsHow to consume Razor data in a javascript file
I’m new around here, I’m trying to consume Razor data inside a js file. From what I understand the two languages do not communicate so I would need an alternative that does intermediation, taking…
-
0
votes1
answer19
viewsCompare the number of rows of a list in a Viewbag
I need to know how many lines(in view) I send from my controller in a type list<> for a viewbag in the view. With this enable or not the option to create new images. Controller:…
-
0
votes0
answers27
viewsHow to cascade a multiselect list based on selecting a Dropbox with Asp.net core Razor
I need help to create a dynamic control. I’m a beginner so... Problem: The page has a selectlist which shows the records of the Jobs table returning the Jobid in the post. I need to capture the id…
-
0
votes0
answers31
viewsI cannot get the Selected Dropdownlistfor element inside a Partialview to send to the Controller via Actionlink
Hello I have a Partialview that is filled with selected entries through previous filters. partial view is no more than the presentation of a table with multiple rows in which each row will be a…
-
0
votes1
answer209
viewsNullreferenceexception: Object Reference not set to an instance of an Object. How to resolve?
I am developing an application that consumes data from an API and shows to users, but I am facing an exception: NullReferenceException: Object reference not set to an instance of an object. How do I…
-
0
votes1
answer38
viewsHow to show the data on the front end using Razor pages?
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 don’t know how to show the data on the front end. I am using REFIT…
-
0
votes0
answers69
viewsLoad a partial view into the modal bootstrap
Following , I’m trying to load my partial view into the modal but I’m not getting it. I’ve tried several ways, including with the @Html.Parcial , However, if you do so, the string company_details…