May 18, 2021, 11:52 AM
Partial Rendering
I'm trying to figure out how to do Partial Page Rendering in Ext.NET 7, as per the example on the 5.3 examples site: https://mvc5.ext.net/#/Dynamic_Parti...rtial_Content/
Can a Razor Page be used as the source for loading partial content? I have created a Razor Page with Ext.NET markup in the .cshtml file, and whose code-behind can handle GET requests. However, when this page is requested via a ComponentLoader, no script content is generated by the page. All that is returned is the following markup:
BookingsByMonth.cshtml
Thanks
Paul
Can a Razor Page be used as the source for loading partial content? I have created a Razor Page with Ext.NET markup in the .cshtml file, and whose code-behind can handle GET requests. However, when this page is requested via a ComponentLoader, no script content is generated by the page. All that is returned is the following markup:
<div id="App.ctl01_Container">
</div>
My Razor Page:BookingsByMonth.cshtml
@page
@model TMSWeb.ExtNETCore.Pages.Auth.Dashboard.Widgets.BookingsByMonthModel
@{
}
<ext-cartesianChart>
<store>
<ext-store data="Model.ChartData">
<fields>
<ext-datafield name="month" />
<ext-datafield name="bookings" />
</fields>
</ext-store>
</store>
<axes>
<ext-numericAxis position="Left"
fields="bookings"
grid="true"
title="Bookings"
minimum="0" />
<ext-categoryAxis position="Bottom"
fields="month"
title="Month" />
</axes>
<series>
<ext-barSeries highlight="true"
xField="month"
yField="bookings" />
</series>
</ext-cartesianChart>
BookingsByMonth.cshtml.csusing System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using TMSWeb.Interfaces.NETCore.CQRS;
using TMSWeb.Models.NETCore.Dashboard;
using TMSWeb.Queries.NETCore.Dashboard;
namespace TMSWeb.ExtNETCore.Pages.Auth.Dashboard.Widgets
{
public class BookingsByMonthModel : PageModel
{
private readonly IQueryHandler<GetBookingsByMonthQuery, List<BookingsByMonth>> _queryHandler;
public BookingsByMonthModel(IQueryHandler<GetBookingsByMonthQuery, List<BookingsByMonth>> queryHandler)
{
_queryHandler = queryHandler;
}
public List<object> ChartData { get; set; }
public async Task OnGetAsync()
{
ChartData = (await _queryHandler.HandleAsync(new GetBookingsByMonthQuery(2020)))
.Select(obj => new { Month = obj.MonthName, Bookings = obj.CountOfBookings })
.OfType<object>()
.ToList();
}
}
}
If not, how can I return an Ext.NET PartialViewResult from a controller action in Ext.NET 7.2? I can't find this type when browsing through Intellisense.Thanks
Paul