Category "razor"

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

How to render and preserve <br> tags as line breaks using @Html.TextAreaFor

I'm migrating an ASP Classic app to ASP.Net MVC 5. The legacy data contains <BR> tags in the text. In the old application (still in use) the tags are rend

CompilationFailedException during runtime compilation of Razor from AspNetCore TestHost

I have ASP.Net MVC application, one part of it is compiling razor views to string. The code is very similar to this example: https://long2know.com/2017/08/rend

How to load razor page before it's done rendering?

I have a table of records in Index.cshtml, once a user clicks on a record to view the details it will take them to Details.cshtml. The issue is, there is a lot

How to reset custom validation errors when using editform in blazor razor page

I have an editform using an editcontext: <EditForm OnValidSubmit="HandleValidSubmit" EditContext="_editContext" Context="auth"> <DataAnnotat

Update only two columns of table in razor pages

I have a razor page configuration that returns a a partial view with an entire table in it: <div class="col-12 border text-left p-3 mt-3 d-flex"> <

azure ad authentication issue with razor handlers

I'm experiencing a strange issue using msal.js for user authentication in a web app that already has a standard login page. I'm totally new to Azure AD, so prob

New line character from c# to cshtml

I am making a webpage... the controller is written in C# and the webpage is in cshtml. In the c# file, I am constructing strings to be put into the table on the

Razor engine cant find view

I'm trying to render a HTML from a view without using a web request. I need the HTML as a string, internally, I do not wish to serve it. The viewEngine.FindView

How do you escape a '@' symbol within in a url with razor

I know this is probably going to be something very simple and it is like just a 'gotcha' that I have yet to get; however, I have been struggling with escaping t

ASP.NET Razor Pages submit button does nothing

I have this view: @page @model TreesOnMars.Pages.NewGameModel @{ ViewData["Title"] = "New Game"; } <h2>New Game</h2> <form method="POST"&g

Importing excel table to ASP.NET C# MVC

I have table in a excel sheet called ListProduct.xls. When I import the excel file I want it to print the table in success page. The index page works fine I can

How do ASP.NET Core's "asp-fallback-*" CDN tag helpers work?

I understand what the asp-fallback-* tag helpers do. What I don't understand is how. For example: <link rel="stylesheet" href="//ajax.aspnetcdn.com/aja

How do I post SQL data using submit button in asp.net c# razor

Thanks in advance. Can anyone please help me get this button working so I can display a row from the Northwind database 'only' when the button is clicked. I h

Shared UI using Razor Class Library, RCL, between .net Maui Blazor & Blazor webassembly

I'm following this demo by D. Roth https://youtu.be/7UM6s0QPvRQ?t=3530 58:50 Demo: Sharing Blazor UI between web and .NET MAUI I was wondering if "index.html" c

How can a razor for loop be used in a javascript script tag?

The error generated is "Conditional Compilation is turned off". Conditional Compilation hack from MSDN is prevalent but fails. There are several questions lik