Category "razor"

Get the very last part of a Url to use in a ternary operator

I've very new to C# and I'm using ASP.NET 6. On a .cshtml Razor page I'm trying to use a ternary operator to fill in a HTML element class based on the very las

Viewbag content does not appear

I have an APS.Net web app Razor view where I attempt to display the Viewbag.errormessage. The action method populates the viewbag but the view does not show the

Render angular.js template on click href

Hei friends,I'm kind rusty on mvc I need help. This is the cshtml ,my html and script is in the same page ,I want to render angular html Without refreshing page

How to Bind a List in Model with HTML Form in ASP.NET Core?

I'm unsure what I'm doing wrong when trying to map form values to my model, FieldMappingCollection. I've been able to get the Id and Name back for the model but

Blazor Hybrid App how to navigate to pages

How can I navigate between Razor pages in an Blazor Hybrid App? I found this explanation: https://docs.microsoft.com/en-us/aspnet/core/blazor/hybrid/routing?vie

Encoding issue when saving files with javascript?

i've been trying all day to setup a function that creates a file from plaintext or a stream in a razor page. i create csv plaintext in a backend and send it to

Is there a way to execute function before unloading razor view of _Layout asp.net core

I know that I can bind handler to onbeforeunload event and execute something before full page unload. But is there a way to do this on razor view of _Layout?

Does RuntimeCompilation of Razor templates on iOS work (with xamarin)?

For a project I have to know whether runtime compilation of razor templates on iOS (xamarin) devices would work. Right now I have no emulator or iOS device avai

Razor components - cascading parameter values

How do you pass a reference to the parent RenderingFragment to the child component/content when creating a razor component in c# (NOT using .razor) ComponentBas

How to show deserialized TempData object in view?

I'm getting System.NullReferenceException: 'Object reference not set to an instance of an object.' error in Index2.cshtml file after deserializing my TempData o

How to create NavMenu with collapsible submenu in .Net Core Blazor app

I am trying to create a blazor navmenu which has a shape like this item a item b when I click on item b it expands with sub menu like this and clicking on subi

Compilation error after publishing individual Razor page. Persists after publishing entire project. ("Compilation references may be missing")

Today I was working on a .NET Core 3.0 project (VS 2019). I added a CSS class to a <span> on one of my pages. That's it. Nothing else. I figured publishin

ASP.NET Core form ignoring asp-controller

I'm working on an ASP.NET Core application. Part of it is an image gallery which allows the user to upload images. On localhost this works as expected, but when

CSHTML WYSIWYG editor/previewer

I wanted to create an Asp.net Application, but I can't find a WYSIWYG editor in Visual Studio or even a Previewer, is the only way to see what your page looks l

Null Reference Exception when calling GraphServiceClient from a .net core Razor application that uses OpenIdConnect

I am working on a DotNet Core Razor application that uses OpenIdConnect to authenticate against Azure AD. This site is currently targeting the .net 5.0 framewor

ASP.NET MVC: Method for HttpPost is not executed

In an ASP.NET MVC application, I have a file MessageController.cs where I define EditMessage for access via HttpGet and HttpPost. Usually the user first accesse

Can c#/Razor work with DyGraph WITHOUT Javascript?

In this question: Previous DyGraph question There is still the need to go to JavaScript to call DyGraph: <script type="text/javascript"> g = new Dygraph

Button Click to return to the same page with same input parameters

I want users to navigate back to the same page after the button is clicked on the page. If the user URL is https://localhost:xxx/Inventories/Index/38?custID=38&

ASP.NET MVC (Razor) vs Angular 5

We are currently considering moving from ASP.NET MVC to Angular 5, mostly because it seems like the best and latest framework. However none of us seems to be ab

C# Razor partial view using an iFrame returns dictionary error "`1" and "`2"

I am attempting to load a partial view into an iFrame and receiving the below error. When loading the same partial not inside of a iFrame, there is no issue. Lo