@page "/Admin/AspNetUsers/UserRollen"
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
@inherits ListBase
@using Syncfusion.Blazor.Grids;
@using Syncfusion.Blazor.Buttons;
@using Syncfusion.Blazor.Spinner;
@using BlazorApp.Helper
@using BWPMModels;
@using BlazorApp.Controller;
AspNetRoles
@code{
SfGrid Grid { get; set; }
public List GridData { get; set; }
public List AspNetRoless { get; set; }
public List GridDataUser { get; set; }
public List AspNetUsers { get; set; }
string userid = "";
public static int? pkey { get; set; }
public bool Initial { get; set; } = true;
public bool ContinuePaging = true;
public bool InitialRender { get; set; }
public int Value = 0; // consider that value your querystring contains
public int foundrow = 0;
protected override void OnInitialized()
{
/// GridData = OrdersDetails.GetAllRecords();
GridData = BlazorApp.Controller.AspNetRolesController.GetAllData();
GridDataUser = BlazorApp.Controller.AspNetUsersController.GetAllData();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
userid = await sessionStorage.GetItemAsync("UserID");
if (userid == null)
{
var authState = await authenticationStateTask;
var userId = authState.User.Claims.FirstOrDefault().Value;
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
await sessionStorage.SetItemAsync("UserID", userId);
}
else
{
await sessionStorage.SetItemAsync("UserID", userId);
}
}
}
private async Task OnBeginHandler(ActionEventArgs Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
if (Args.Action == "Add")
{
}
else
{
BlazorApp.Controller.AspNetRolesController.POST(Args.Data);
}
}
}
public async Task OnCompletedHandler(ActionEventArgs Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
}
}
public async void RowDataBoundHandler(BeforeDataBoundArgs args)
{
if (!Initial)
{
//await Task.Delay(100);
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
//this.Grid.SelectRow(Convert.ToDouble(Idx));
}
Initial = false;
}
}