Questions tagged [razor-pages]

If you have any queries regarding the Razor Pages Framework, feel free to seek answers here. The framework is a fantastic addition to ASP.NET Core since version 2.0.

Iterating through the entire table presents a challenge when trying to display multiple values on a single element

I'm facing a challenge in dynamically adding data from an SQL Table to HTML. Here is my loop: @foreach (var item in Model.ModulesSubStages) { <div class="row"> <div class="col-md-6"><a id="courseRed ...

Can AJAX be used to send a POST request to a Razor page model from a different page? (Illustration)

Trying to enhance my skills in web development, I decided to experiment with using only the POST method of a Razor page/model for an AJAX script to upload a file via another razor page without treating the "FileUpload" page as a standalone page. I'll ...

How can I properly bind a list of objects with nested lists when submitting forms?

Trying to bind a complex object that consists of nested lists of objects poses a challenge. While the data binds to the page successfully with pre-populated content, issues arise when posting the form to the handler method. I can post and bind the parent ...

ScriptManager is not accessible in the current ASP.Net Core Razor Page context

I'm facing an issue where I have a view (such as Index.cshtml) and a page model (like Index.cshtml.cs). In the view, there's a JavaScript function that I want to call from the OnPost() method in the page model. I tried using ScriptManager for this purpose, ...

Display additional fields based on a condition in ASP.NET Core 6.0 MVC for a Yes/No input

If a user enters either Yes or No in a specific field, I want to display additional fields that need to be filled based on their choice. <div class="col-6"> <label for="Renda Bruta">Demonstrativo do Ano</label> ...

enhance user interface by dynamically updating progress bar from Razor server

I have implemented a progress bar on one of my razor pages. When I call it using an onclick event, it works perfectly fine. However, the problem arises when I try to get it working from the server side. Below is the code snippet: using Microsof ...

Using a third-party Vue component within a .NET Core Razor Page, such as Vue Cal, can be easily achieved by following these steps

Greetings esteemed individuals of Stack Overflow. I am currently experimenting with the combination of .NET Core Razor Pages and the VueJS JavaScript framework. I'm interested in utilizing the Vue Cal library to showcase a calendar view on my Razor Page. ...

Getting an out-of-range exception (System.ArgumentOutOfRangeException) in C# Razor pages while attempting an AJAX call

I have a razor page model that contains a get-method. public IActionResult OnGetDuration([FromBody]int id) { Subject subject = _service.GetSubjectById(id); int duration = subject.LessonsPerWeek; return new JsonResult('a'); } ...

Unable to send data through ajax to razor pages

I'm encountering an issue where the data I'm trying to send to a Razor Page method always comes through as 0. Here's the code: Razor Page: public IActionResult OnGetProducts(int page) { var products = _productRepository.GetProducts(); ...

Is it possible to implement dependency injection within a .css document?

I have a C# .NET 6 application. Some of the web pages (Razor Pages) in the app use dependency injection to inject configuration into the Razor Pages (.cshtml files), allowing certain config elements to be displayed in the user interface. My query is, can ...