The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am sfDataGrid in Blazor Server App to display data. My App has two related models Category and Subcategory.
I want to display rows of Subcategories in the sfDataGrid. In stead of displaying the CategoryId(which is the foreign key) in Subcategory, I want to display the category name. I try to use CategoryId property of subcategory model as show in code block shown below but it throws null reference error. Apparently because it does get set.
I should be very grateful I anyone is able to help me out. Relevant section of my code is shown below
[Inject]
public ISubCategoryService subcategoryService { get; set; }
[Inject]
public ICategoryService categoryService { get; set; }
public List GetSubCategories { get; set; }
public SubCategoryForDetails GetCategory { get; set; }
public SubCategoryForDetails subcategory { get; set; } = new SubCategoryForDetails();
I have decided to use navigation property to obtain the Category Name. I thought I should let you know.
Thanks anyway for your usual assistance
RNRahul Narayanasamy Syncfusion Team January 27, 2021 01:52 PM UTC
Hi Paul,
Greetings from Syncfusion.
We have validated your query and we might suspect that you are facing difficulties while showing the foreign key values in Grid. We already have a default foreign key column support for this. Please find the below documentation for your reference.