I want to limit the display of records based on login information in the grid. I receive an NullReferenceException below;
I would appreciate your help,
protected override async Task OnInitializedAsync()
var authstate = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authstate.User;
var name = user.Identity.Name;
if (name != null)
if (name.IndexOf('@') >= 0 && name.IndexOf('@') < name.Length - 1)
DomainName = name.Substring(name.IndexOf('@') + 1);
if (DomainName.ToLower() == "gmail.com")
PreFilterVals = "ABC";
else if (DomainName.ToLower() == "yahoo.com")
PreFilterVals = "DEF";
ListOD = PSMServices.GetAllODData();
ListHC = PSMServices.GetAllHFData();
if (PreFilterVals == "ABC")
await ODGrid.FilterByColumnAsync("CSO", "contains", "ABC");
else if (PreFilterVals == "DEF")
await ODGrid.FilterByColumnAsync("CSO", "contains", "DEF");
An unhandled exception occurred while processing the request.
Index.razor, line 229
Greetings from Syncfusion support.
We would ,like to inform you that we have to get Grid instance only after Grid rendered. This is the reason for an issue. But You want to perform filtering operation for multiple columns programmatically at initial rendering. You can achieve your requirement by using DataBound event and FilterByColumnAsync method. Kindly refer the attached general links for your reference.