Category "razor"

Changing String From Another Model

Is it possible to change a string from another model, basically we have a simple login page which takes the username and then directs you back to the index main

Can I output a raw HTML/CSS/JS file using Razor/Razor engine

I am trying to build a character sheet for roll20. While I understand I can use other systems for this, I am trying to learn C# and I figured doing this using C

MVC: No parameterless constructor defined for this object

I have the following controller definition public class FeaturedAccommodationController : Controller { ... public FeaturedAccommodationController(IAccom

ASP.NET Core MVC & C# - redirect to same view ( action ) when changing language using culture

I have localization in my project. What I want is to whenever a user changes language it redirects him to the same page he was in. But now I always redirect him

Ask the user before submitting the form

I have a cshtml page with this code: <form action='@Url.Action("ExportExcel", "Records")' method="post" target="_blank" onsubmit="return exportExcel(), true"

Generate JWT Token for logged in user?

I have a razor pages app [username and password auth] and a WebAPI app that uses JWT auth. Both the services use the same user table. After user proceeds to che

how to apply numeric validation

I want to apply validation for integer but it's not working function fnAllowNumeric() { if ((event.keyCode < 48 || event.keyCode > 57) && ev

Blazor Repeatable EventCallback for Menu Item

I am working on a repeatable "Card" component that has a list of menu items and actions that this menu can take. However I cannot get the functionality to work

How to suppress compiler errors within vctmp.cshtml files in Visual Studio?

Whenever I open a temporary cshtml file or compare the difference between the files, the compiler shows a bunch of errors. It's unable to resolve razor syntax d

asp.net core binding null in controller post request (list with inside elements lists in view)

I have a view with a list of items that among their properties have a list of items (in View asp.net core). I use a generic list to have common properties that

Is it good practice to use razor pages directives inside javascript <script> tags to pass model property values?

I'm developing a web app using asp.net core MVC and I've found my self using razor pages directives to pass model property values to javascript for further mani

Blazor Razor Class Library (RCL) No CSS Intellisense

I have a razor class library (RCL) that contains all the pages from my blazor application. The CSS intellisense does not seem to work within the RCL unless I ch

How to invoke awaiting js fuction in razor pages c#

I'm using SignalR. I want to send updating request by websocket for each elements in foreach to update timer. But i'm getting error.Maybe connection can not get

ASP.NET Core Razor Read related data into table

I am trying to create a asp.net core 2.1 razor website that will load two tables on the one page. Below i have defined my classes ItemMasters and DealMasters. I

ASP.NET MVC - Populate SelectList with Font-Awesome Icons

I've populated List with font-awesome strings like: private static readonly List<string> Icons = new(){ "<i class=\"fas fa-users\"></i>",

How to get attribute of dynamically generated element ASP.NET

I know there are tons of questions on this topic and I've tried many of them to no avail. If anyone has any suggestions, it would be greatly appreciated. I'm tr

How can I read in an edited textarea?

I'm trying to get the new textarea value to read into my controller so that way I can store the new value in my SQl database. View: @{ ViewBag.Title = "TRIO

Trying to Edit and Continue on a cshtml file is always throwing an exception

When I make any change to a CSHTML file while debugging then reload the page, I get this exception. This used to work, and I'm not aware of any changes that cou

automatically read path to Razor page in Nav Menu

What I want to do is to read the path as indicated with the @page attribute of every Razor Page, to link to it in the Nav Menu. With the purpose of not having t

How to set Default value as null for InputDate field in Blazor?

I have many InputDate fields in my editform of Blazor. When I run my code, by default its set to 01/01/0001. It kinda looks weird to me . I feel it should be se