Questions tagged [razor-pages]

Apply to questions related to the Razor Pages Framework, which is a feature of ASP.NET Core starting in ASP.NET Core version 2.0.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

Sort On an .Include on Razor View Not Working

I've done basic sorts before and not had an issue, but this one has me stumped as to what I am doing wrong. All it returns is a blank page. Details.cs (showing the sort code) using RabiesClinics.Data; ...
MelB's user avatar
  • 159
0 votes
0 answers
57 views

Razor code on asp.net view doesnt apply changes to the website

I am trying to assign an action method to a line in a .cshtml file but despite what I put no changes are reflected on the site. Here's the razor code: <div class="container mt-4"> ...
Talha Emre Ünal's user avatar
0 votes
0 answers
42 views

Combobox always visible from all pages of the ASP.NET Core 7.0 razor pages application (no MVC)

How can I make a combobox always visible from all pages of the ASP.NET Core 7.0 Razor pages application? I tried to insert a form with the combobox in the _Layout.cshtml file but I can't populate it ...
steve fax's user avatar
1 vote
0 answers
24 views

can I have a fieldset in razor with 2 parameters?

I have an old razor page in a 4.8 Net framework project. I have a datepicker for a input start date already, and I need to add another one for the end date. The end date has to be in the same row than ...
Iria's user avatar
  • 21
0 votes
0 answers
26 views

Configurating STJ serializer options in ASP.NET Core Razor Pages

I have a ASP.NET Core 8 application that uses Razor pages. The endpoints internally use a HttpClient to get data from a downstream API. The downstream API is configured to serialize enums as strings ...
Kralizek's user avatar
  • 2,019
0 votes
1 answer
78 views

Handling multiple items of data on the same view page

I have 3 pages on a app I am writing. It is historical, view Rabies Vaccine info only. Owner Info - has a view list of pets owned Pet Detail Info - has a view list of vaccines received by that ...
MelB's user avatar
  • 159
0 votes
1 answer
18 views

Standard login page and 400 error due to AntiforgeryToken

The standard Login razor page has an issue when you do the following Make sure you are logged out Open 2 tabs in the same browser, with the login page on both Login in on 1 tab, then try to log in on ...
Brian's user avatar
  • 154
0 votes
1 answer
34 views

Razor Pages Template Project Routing Does not Work out of the box

I created ASP.NET Core 7 web app right out of the VS2022 template (no MVC template). No authentication was added. Only high level code in Program.cs. Then, I tried to run it, and no matter what I do, ...
Leon's user avatar
  • 317
0 votes
0 answers
36 views

cshtml file has no attached C# file

I have a Razor page with the .cshtml file extension. Register.cshtml @using Project.Models.Auth @model RegisterModel @{ Layout = null; } <!DOCTYPE html> <html> <head> <...
iKingNinja's user avatar
0 votes
2 answers
47 views

Razor pages combined with ASP.NET Core MVC are having routing problems

I am new to Razor pages and to all ASP.NET Core, so most of the chances it is my ignorance... I am developing an ASP.NET Core 7 web app. Initially I started from the MVC project template and then ...
Leon's user avatar
  • 317
0 votes
0 answers
49 views

I cannot retrieve the name part in the database

I am following a developer but I would like to ask for your help for an issue that I cannot comprehend, when I try to bring the name of the Universities to the University field in my own application, ...
Mehmet's user avatar
  • 23
0 votes
0 answers
25 views

ASP.NET Core Razor page call COM dll runtime error: COMException: Retrieving the COM class factory for component with CLSID, error: 80040154

I had an old ASP.NET webforms project to call COM dll (written in C++, build in win32), and that is OK on my PC. I start a new project (ASP.NET Core Razor pages, VS 2022) and do the migration from the ...
unknownObj's user avatar
0 votes
1 answer
24 views

Using Tailwind in ASP.NET Core Razor page, can I use @model in calc()?

Here's my problem. I am using Razor pages and Tailwind. I want to use the @model expression in the tailwind syntax. In this way, I will get rid of the switch case structure. It seems to be working ...
Mustafa Kaya's user avatar
1 vote
1 answer
54 views

DataTable is not displaying data received by AJAX

I'm currently learning how to display AJAX-received data to DataTables using .NETCore 6 Razor Pages. Here's the front-end code: <table id="dataTable" class="table table-striped" ...
N. Tanaka's user avatar
0 votes
1 answer
49 views

.NET Core ChangeTracker returning invalid values

I am rewriting an application that was written 12 years ago using ASP.NET v4 with SQL Server 2014, and I'm using ASP.NET Core v6 Razor with SQL Server 2019, and yes I am required to use v6 because of ...
Robert Hames's user avatar
0 votes
0 answers
25 views

Razor page download function results in 403 Forbidden

I have this simple download function in my Razor Page: public FileResult OnGetDownloadFile(string fileName, string Username) { string path = Path.Combine(@"C:\DownloadTool\Downloads\", ...
Mason's user avatar
  • 535
0 votes
1 answer
39 views

ASP.NET Core: Razor: Post QueryString as is to a razor handler

I have a razor handler named OnPostDisplay that takes in a few [FromQuery] parameters and a [FromBody] parameter. How do I form the URL in my ajax request to this handler? What I'm trying to achieve ...
SoftwareDveloper's user avatar
0 votes
0 answers
29 views

Multiple db context in a ASP.NET 7.0 razor pages web application

I would like to make an ASP.NET 7.0 razor pages web application can access different databases depending on the user used after it has passed the authentication phase. In practice, user "U1" ...
steve fax's user avatar
0 votes
1 answer
30 views

In ASP.NET Core use audio control to play audio from hex string

I want to add an audio control to my ASP.NET Core code. When I set the source of the control to be a file it works. Now I have the audio as a hex string that I retrieve from the database, and I want ...
tzviya's user avatar
  • 539
0 votes
1 answer
24 views

Scaffolded Razor Create Page doesn't add item

I created a "create" razor page through scaffolding for the following model: public class Product { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ProdId {...
Tareq Ewaida's user avatar
0 votes
1 answer
29 views

Passing Array from datatables.net JavaScript to asp.net Razor pages

I'm using Visual Studio 2022 asp.net Razor pages project and trying to pass an array from a DataTables.net table of selected records back to .cshtml.cs OnPostRemove. It appears that the array is being ...
confusedUser1's user avatar
0 votes
1 answer
51 views

Pass Data From One Razor Page to Another Razor Page

I need some assistance please. I have not done this before and I'm not entirely sure what to add where. Basically, I am working on an app to house historical data. There is no create, edit or delete ...
MelB's user avatar
  • 159
0 votes
0 answers
50 views

Problems with client side validation working for ASP.Net Core Razor page

After reading similar issues here, I finally got client-side validation working, but it has issues that I was hoping others might be able to help with. Here is an example form field that I'm trying ...
Levi Wallach's user avatar
0 votes
0 answers
39 views

Blazor doesnt resolve dependencies of a Razor Class Library

My current Project has a main Blazor an UI-Component in a Razor Class Library. In this component I am trying to use a UI-Library called Radzen. So the line of dependencies would look like this: Blazor ...
Joschi Stock's user avatar
0 votes
0 answers
37 views

Client-side pagination for Partial View in Razor Pages C#

I am a beginner in razor pages. Initially on clicking the Movies tab on sidebar, I get the table with movies displayed. Then based on search my partialView updates to display the data. I want to add ...
flash speedster's user avatar
0 votes
1 answer
30 views

AJAX Calls in Tag Helpers Not Reaching in referenced project Controllers in .net 7

`I'm working on an ASP.NET Core razor page application where I use custom tag helpers from a separate project. These tag helpers make AJAX calls to various controllers in my main project. However, ...
Rifat Hussain's user avatar
0 votes
0 answers
44 views

"Object object" bug when trying to render stepper PrimeVue in razor .cshtml

I installed PrimeVue library for my Vue.js app that it's inside of a .NET solution, and when I try to render the Steps component from PrimeVue v2 text, the Object Object error appears Tag used for ...
Manuel Turlan's user avatar
1 vote
1 answer
58 views

Quick way to debug my app using Production environment

By default, ASP.NET Core applications run in the Development environment when running within Visual Studio. I need to debug the Production environment. What is the easiest way to switch between ...
Jonathan Wood's user avatar
-1 votes
0 answers
83 views

Blazor doesnt resolve dependencies in Razor Class Library

My current Project has a main Blazor an UI-Component in a Razor Class Library. In this component I am trying to use a UI-Library called Radzen. So the line of dependencies would look like this: Blazor ...
Joschi Stock's user avatar
0 votes
1 answer
33 views

Razor JavaScript Interop won't "window.close()" because of security issue

I have a razor page which has a button for closing the browser window using window.close(), and it works fine in the initial browser window when the app starts, because according to the docs, you can ...
NovaDev's user avatar
  • 2,787
0 votes
1 answer
39 views

ASP.NET Core's BindNever does not work with record

When using Razor Pages 7 I have this in the code-behind file: public record PersonDto( long Id, string Name, [BindNever] string Address, // ... ); [BindProperty] public PersonDto Person { get;...
lonix's user avatar
  • 15.2k
0 votes
1 answer
63 views

CRUD Razor Scaffolded Page is not styled

After I created my entity models and I generated migrations, I made CRUD scaffolding for one of the entities, but the pages were not styled at all, and all the links weren't working, I added the ...
Tareq Ewaida's user avatar
-1 votes
1 answer
60 views

Asp.net core how to get json value in razor page without ajax call

I receive a json string from the server side that I want to access its values. This string is not received by Ajax call and I want to have its value in Razor Page. In the picture above, two values, ...
topcool's user avatar
  • 2,526
0 votes
1 answer
48 views

.NET Razor pages, scoped dependency injection properties cleared on postback

I'm trying to implement persistent storage on my Razor pages project. What I need is that on postback on my pages, the property values should not be cleared. I am doing this with dependency injection. ...
nerdalert's user avatar
  • 441
-2 votes
0 answers
58 views

How can I create dynamic properties of database columns at runtime?

I want to create syncfussion datagrid fully dynamically. I'm trying to create a dynamic class that creates properties at runtime instead of hard-coded properties. Please guide me on how can i do that. ...
Mohamad Usman's user avatar
0 votes
1 answer
98 views

How to call a Razor page C# method from Layout.cshtml

I have a .Net6 razor page application, there I have a page called Index.chshtml and the corresponding code behind file Index.chshtml.cs Now I have a method in the Index.chshtml.cs file called ...
Bluemarble's user avatar
  • 1,939
0 votes
1 answer
26 views

can't load geojson file into azure maps using javascript, but gives 404 error

I am attempting to load a geojson file in azure maps, I am building a standard razor pages web app in visual studio. The geojson files are in a folder called 'data', but when I try to load the files I ...
Erik Bussing's user avatar
1 vote
1 answer
48 views

ApplicationUser class (to define Extented Properties) in .NET 6. I am not getting the user data using the ApplicationUser properties

I define the ApplicationUser class to add some additional column into User table. But i am not able to get data from User table by using ApplicationUser properties. 1. Program.cs builder.Services....
MD SAQUIB RAZA's user avatar
1 vote
1 answer
88 views

Razor Pages - Show the loading Spinner using AJAX when page loading

I am trying to load the data into a div with the loader.gif spinner when the page initially loading. Here is the page ListViewLoading.cshtml: @page @model RazorPagesCollection.Pages.PopUp....
Milacay's user avatar
  • 1,441
0 votes
1 answer
91 views

Razor Pages - Refresh Page from Partial View After Updated Data

I am trying to figure out how to refresh the page from Partial View after updated data, but I am stuck. Here is my index.cshtml page: @page @model RazorPagesCollection.Pages.PopUp.IndexModel @using ...
Milacay's user avatar
  • 1,441
-1 votes
2 answers
43 views

Regular Expressions Razor Pages ASP.NET core @"^[A-Z]+[a-zA-Z""'\s-]*$"?

What does the '\s-]*$" at the end of @"^[A-Z]+[a-zA-Z""'\s-]*$" stand for? Am I right saying it means no white space and numbers allowed? I understand the start of it, just ...
scarlet's user avatar
  • 33
0 votes
1 answer
34 views

ASP.NET Core 7.0 Razor Page View Model's localizated strings display only as Keys

I use ASP.NET Core 7.0 I'm trying to localize the login error message (or any other string) on my Identity/Account/Login razor page (it has been generated by the Visual Studio 2022 earlier on, so it ...
mariob's user avatar
  • 1
0 votes
1 answer
52 views

Razor Pages cannot find partialView even it exist in the same directory

I am trying to call a partial view named "topbar", but every time i try to call it with extension (<partial name="topbar.cshtml" />) or without it : <partial name="...
Khaled Ahmed's user avatar
0 votes
0 answers
65 views

Handle errors in RazorPages OnPost handler without side effects

Suppose an OnGet handler loads data used on the page. Then if an error is encountered in a corresponding OnPost() handler, it cannot simply return RedirectToPage() but rather must reload that data ...
lonix's user avatar
  • 15.2k
1 vote
1 answer
143 views

Updating values of a chart in a razor page

I created an Asp Net Razor project in visual studio 2019. I'm learning the technology with some exercises. Specifically, I would like to display on a page a chart whose data i would like to retrieve ...
Daniel Scerpa's user avatar
0 votes
1 answer
35 views

How to write RenderViewToString in ASP.NET Core

I m using this method for render view in ASP.NET core. But it returns empty. What is the reason? Please help me. I tried different ways like this link https://www.learnrazorpages.com/advanced/render-...
ayse's user avatar
  • 15
0 votes
0 answers
41 views

How can i access my ConnectionString from AppSettings.Json without mentioned the name of the connection string in a Razor page Project?

I am creating custom Authentication code. The project is going to be packaged and installed in other "Agency Projects" each agency may have their own connection strings agenycOne, agencyTwo ...
DAkers's user avatar
  • 1
0 votes
2 answers
81 views

How do I implement a date range filter on my webpage?

I have the following date pickers: <div style="margin-bottom: 20px;"> <label for="startDate">Start Date: </label> <input type="date" id="...
X888ARJ's user avatar
0 votes
0 answers
20 views

Got 500 error when loading a SSRS report from ASP.NET Core Razor page via iframe to a webform?

I implemented an ASP.NET Core Razor pages app to display a SSRS report by iframe to a .NET framework webforms on VS 2022. I deployed the .NET framework webforms and SSRS report to each server and ...
zbx888's user avatar
  • 1
0 votes
1 answer
46 views

Showing Annotation Line based on Condition

I want to show the horizontal line on top of bar based on some conditions. As shown, in the figure, i want to show the horizontal line only till Tuesday, which means i want to display the line till ...
Teena's user avatar
  • 163

1
2 3 4 5
86