razor-pages Questions

8

Solved

I'm preparing a migration from ASP.NET Core 2.2 to 3.0. As I don't use more advanced JSON features (but maybe one as described below), and 3.0 now comes with a built-in namespace/classes for JSON, ...

1

Solved

Is there a better way to navigate from one Razor page to different Razor page when a button is clicked. I want to navigate from Index.cshtml to Inventory.cshtml when the button is clicked. Below is...
Marathon asked 12/3, 2022 at 22:12

1

I'm trying to migrate a Razor Pages app to a Blazor Server app as part of a staged migration (rather than big bang). I'm currently moving a relatively straight forward CRUD set of pages. These page...
Canale asked 2/3, 2022 at 3:39

5

Solved

I am unable to implement policy-based authorization in ASP .NET Core for an action on a razor page. I read through this comprehensive document on authorization and used its examples as guidence. ...
Parrett asked 13/8, 2019 at 12:19

3

System.InvalidOperationException: 'The database provider attempted to register an implementation of the 'IRelationalTypeMappingSource' service. This is not a service defined by Entity Framework and...
Mechanics asked 23/12, 2020 at 10:42

1

Solved

I am encountering an issue where the returnurl is not being formatted correctly after adding an Authorization Policy to my ASP.NET 6 Web App Program.cs. Steps to reproduce the issue: Create ASP.NE...
Downtrend asked 22/12, 2021 at 20:58

2

Solved

In ASP.NET Core 2 application I set up some services: public void ConfigureServices(IServiceCollection services) { services.AddDbContext<MyContext>(options => options.UseSqlServer( Con...
Trumpery asked 23/11, 2017 at 21:1

2

It's possible to set multiple using dataTransfer? HTML <tr class="notfirst" draggable="true" ondragstart="drag(event, '@Model.getFormat(item)', '@Model.getColor(item)')" ondragover="allowDr...
Alysonalysoun asked 14/3, 2019 at 16:8

3

Using ASP.NET Razor Pages, I am trying download a file to the browser. From the Page(html), using a link like this works fine: href="/DownloadableFiles/testB.csv" download="newname">Download Li...
Tournedos asked 23/2, 2018 at 17:1

1

Has anyone found a trick for handling multiple forms on a Razor Page? My page has two forms, each with a corresponding model that is decorated with a BindProperty attribute. [BindProperty] public T...
Dandify asked 9/12, 2021 at 17:32

3

I want to write a custom filter which will check whether a user is logged in to my site, and redirect them back to the login page if they aren't. I want the filter to apply automatically to the pa...
Ovi asked 29/11, 2018 at 12:14

1

Solved

I have an ASP.NET Core application with Razor pages and I want take advantages of MVC into it. I added Controllers folder to it with Views and also services.AddMvc() to startup and another endpoin...
Cloudberry asked 25/11, 2021 at 1:50

2

Solved

I cannot get the property Price in the example razor view below to update after OnPostOrder() executes. I wrote this example view to do the following: On change of the product select list, submi...
Clapper asked 24/1, 2019 at 23:30

8

Solved

I've found examples of have multiple handlers on a page and the associated naming convention (ie OnPostXXX) and 'asp-post-hanlder' tag helper. But how can I call one of these methods from an AJAX c...
Walcoff asked 25/9, 2017 at 17:16

3

Solved

I have two .NET Core 5.0 Razor Page Model projects, almost identical, reside in the same solution. Have not been running for almost 4 months. Now when I wish to make some changes. One of the projec...
Turbit asked 6/7, 2021 at 2:33

4

The startup page in my Blazor application is Index.cshtml. I'd like to change the startup page to the homepage, namely my Home.cshtml. I'm using vs2019, ASPNET CORE Blazor (0.9.0-preview3-19154-020...
Om asked 3/7, 2019 at 19:13

5

I have a simple child Blazor component (MyModal) like so: <div class="modal"> <h3>@Title</h3> @BodyTemplate </div> @code { [Parameter] string Title { get; set; } [Para...
Pivoting asked 4/7, 2019 at 19:49

2

Solved

I am having a problem returning a partial view from a razor page, my scenario is I have a partial view which is a form and that has a model. I have 3 forms residing on a single razor pages Form A ...
Cuneate asked 27/8, 2018 at 19:45

3

Solved

I have a model where the property CompanyID allows a null value public partial class ReportTemplateItem { [Key] public int ReportTemplateItemID { get; set; } [Required] public int ReportTempla...
Subcritical asked 22/7, 2020 at 14:56

4

Solved

There has been a question at SO Why is Razor Pages the recommended approach to create a Web UI in Asp.net Core 2.0? where Steve Smith has kindly explained the benefits of using Razor Pages ov...
Shutt asked 5/1, 2018 at 22:4

2

Solved

I want one of my inputs in a form to come from a list of checkboxes that the user selects. I've been going at this for several hours now, and I still don't understand what I need to do for this. Wh...
Spleenful asked 7/7, 2020 at 19:58

2

Solved

as a newbie to Razor Pages I have a question regarding calling methods from Razor Page. The method SubtractProduct() is defined in my domain model. The Index Page has IActionResult sellProduct() t...
Edwinaedwine asked 22/12, 2018 at 10:57

1

Solved

I have a little website and when I do Ctrl+U on the website the UTF-8 characters are not being printed correctly. For example if I try to print programación it prints programación This is ...
Extremadura asked 13/8, 2021 at 18:19

3

Solved

As someone pointed out in a comment, Razor pages doesn't need Controllers, like you're used to do in MVC. I also now Razor doesn't have a native handling of the button click event. To do something ...
Perambulator asked 23/11, 2017 at 16:21

6

I can use an anchor tag helper to go to a different razor page (from an existing razor page) e.g. this works: <a asp-page="./EditReport" asp-route-id="@report.IntegrityReportId" class="btn fa f...
Kimura asked 27/2, 2018 at 16:45

© 2022 - 2024 — McMap. All rights reserved.