We have a similar issue to issue. When the user clicks the back button the syncfusion grid does not show the data. I have verified that the data that is bound to the grid has data in it(see highlighted line below). What could be the issue. I have also shot a video with respect to the issue.
https://www.loom.com/share/6d1085799cea4a82a0764ed53aa95b88
MakePayment.razor:<SfGrid AllowTextWrap="true" DataSource="@Pricings">
<GridColumns>
<GridColumn HeaderText="Hours">
<Template>
@{ var pricing1 = (context as Pricing); @($"{pricing1.minnoofhours} to {pricing1.maxnoofhours} hours") }
</Template>
</GridColumn>
<GridColumn HeaderText="Pricing per hour">
<Template>
@{ var pricing2 = (context as Pricing);
@($"USD {pricing2.pricingperhour}") }
</Template>
</GridColumn>
<GridColumn HeaderText="Discount percentage">
<Template>
@{ var pricing3 = (context as Pricing); @($"{pricing3.discountpercentage} %") }
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
MakePayment.razor.designer.cs:public partial class MakePaymentComponent : ComponentBase
{
[Inject]
protected ILogger<MakePayment> logger { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, dynamic> Attributes { get; set; }
public void Reload()
{
InvokeAsync(StateHasChanged);
}
public void OnPropertyChanged(PropertyChangedEventArgs args)
{
}
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager UriHelper { get; set; }
[Inject]
protected DialogService DialogService { get; set; }
[Inject]
protected TooltipService TooltipService { get; set; }
[Inject]
protected ContextMenuService ContextMenuService { get; set; }
[Inject]
protected NotificationService NotificationService { get; set; }
[Inject]
protected SecurityService Security { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected InstaTranscribeDatabaseService InstaTranscribeDatabase { get; set; }
protected IEnumerable<InstaTranscribeServerSide.Models.InstaTranscribeDatabase.Pricing> Pricings;
protected override async System.Threading.Tasks.Task OnInitializedAsync()
{
try
{
await Security.InitializeAsync(AuthenticationStateProvider);
if (!Security.IsAuthenticated())
{
UriHelper.NavigateTo("Login", true);
}
else
{
await Load();
}
}
catch (Exception exception)
{
this.logger.LogError($"{exception}");
}
}
protected async System.Threading.Tasks.Task Load()
{
var instaTranscribeDatabaseGetPricingsResult = await InstaTranscribeDatabase.GetPricings();
Pricings = instaTranscribeDatabaseGetPricingsResult;
}
protected async Task NoOfHoursChanged(Syncfusion.Blazor.Inputs.ChangeEventArgs<int?> args)
{
NoOfHours = args.Value as int?;
var pricing=Pricings.FirstOrDefault(x => x.minnoofhours <= NoOfHours && x.maxnoofhours >= NoOfHours);
var PricePerHour=pricing?.pricingperhour;
var DiscountPercentage=pricing?.discountpercentage;
var Total = NoOfHours * PricePerHour;
NoOfHoursText=$"{NoOfHours} hours";
PricePerHourText=$"{PricePerHour} USD";
DiscountPercentageText=$"{DiscountPercentage} %";
TotalText = $"{Total} USD";
}
[Inject]
protected IStripePaymentService StripePaymentService { get; set; }
protected async System.Threading.Tasks.Task PlaceOrderButtonClick(MouseEventArgs args)
{
try
{
var session = await this.StripePaymentService.CreateCheckoutSessionAsync(Security.User, NoOfHours);
await JSRuntime.InvokeVoidAsync("redirectToCheckout", session.Id);
}
catch (Exception exception)
{
this.logger.LogError($"{exception}");
}
}
protected int? NoOfHours;
protected string NoOfHoursText;
protected string PricePerHourText;
protected string DiscountPercentageText;
protected string TotalText;
}
|
<SfGrid>
..
..
..
</SfGrid>
@code{
protected override async Task OnInitializedAsync()
{
await Task.Yield();
var instaTranscribeDatabaseGetPricingsResult = await InstaTranscribeDatabase.GetPricings();
Pricings = instaTranscribeDatabaseGetPricingsResult;
// Data bounded here
}
} |