We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Blazor WASM DataGrid Binding Multiple Dependent Dropdown List to Sub Class

From a programmatic structure I have a 'Room Class' with assigned ventilation sub class "RVS" Inside the nested "RVS" class I have a List that I am trying to populate a drop down list in a data grid. The selected 'myCode' value will change the available categories in a List. Example code below. I am having trouble binding in the data grid correctly. I was able to get it to bind to other sub class items of 'RVS' without issue but the drop down is a little tricky.

public class RoomModel
//Multiple other properties or sub-classes here.

public RVSModel RVS {get; set;}

public class RVSModel
public class myCodeClass
public string Code { get; set; }
public int ID { get; set; }

public List MyCodes = new List()
new myCodeClass(){Code = "ASHRAE 62.1 (2016)", ID = 1 },
new myCodeClass(){Code = "IMC CH. 4 (2018)", ID = 2 }

public string MyCode { get; set; }

My razor class is below, bound to 'Rooms'

<SfGrid DataSource="@Rooms" AllowGrouping="true" Height="800" Toolbar="ToolbarItems" EnableVirtualization="true">
    <GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Both"></GridSelectionSettings>
    <GridEditSettings AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
    <GridEvents CellSelected="CellSelectedHandler" TValue="Models.RoomModel"/>
        <GridColumn Field=@nameof(Models.RoomModel.RoomNumber) HeaderText="Room Number" AllowGrouping="false" Width="100" AllowEditing="true" EditType="EditType.DefaultEdit"></GridColumn>
        <GridColumn Field=@nameof(Models.RoomModel.RoomName) HeaderText="Room Name" AllowGrouping="false" Width="250" AllowEditing="true" ></GridColumn>
        <GridColumn Field=@nameof(Models.RoomModel.guid) HeaderText="guid" AllowGrouping="true" Width="150" AllowEditing="true" Visible="false" IsPrimaryKey="true" ></GridColumn>
        <GridColumn Field="RVS.MyCode" HeaderText="Code" AllowGrouping="false" Width="175" EditType="EditType.DropDownEdit" AllowEditing="true">
                <SfDropDownList ID="RVS.MyCode" TItem="RVS.myCodeClass" TValue ="string" @bind-Value"@((context as RoomModel).MyCode)" DataSource="RVS.MyCodes">
                    <DropDownListFieldSettings Value="Code" Text="Code"/>
        <GridColumn Field="RVS.Category" HeaderText="Category" AllowGrouping="false" Width="150" AllowEditing="true" ></GridColumn>
        <GridColumn Field="RVS.Classification" HeaderText="Classification" AllowGrouping="false" Width="200" AllowEditing="true"></GridColumn>

6 Replies

SP Sarveswaran Palani Syncfusion Team November 15, 2022 03:45 AM UTC

Hi Joshua,

Greetings from Syncfusion support.

Based on your query, We have created the sample to bind country sub class list to the DropDown component. Kindly refer the attached sample for your reference and please get back to us if you need any further assistance.


Sarveswaran PK

Attachment: SfGridDropdown_f3d58988.zip

JO Joshua November 17, 2022 02:24 AM UTC

Good evening Sarveswaran,

I had reviewed that sample.  Unfortunately the country sub class is not actually nested within the 'Order' class and therefore doesn't answer my question.  I've tried some alterations to that example and that's where I am stuck.

I have altered altered the provided example to more follow the example that I am asking about.  If this is not possible and I have to change my Code Architecture I understand.  The idea here is that I will have multiple Order classes, all with different Country Options.

I appreciate your assistance!


Attachment: SfGridDropdown_f3d58988_a28d5461.zip

SP Sarveswaran Palani Syncfusion Team November 18, 2022 03:40 AM UTC

Hi Joshua,

we will update the further details on or before 21st November 2022 . Until then we appreciate your patience.

SP Sarveswaran Palani Syncfusion Team November 23, 2022 04:29 AM UTC

Hi Joshua,

From your query, we checked your shared modified sample and found that your using complex databinding in the project. We have already discussed this topic in our UG documentation. Kindly refer the attached UG documentation link for your reference.

Reference: https://blazor.syncfusion.com/documentation/dropdown-list/data-source#array-of-complex-data


Please get back to us, if you need any further assistance

Sarveswaran PK

JO Joshua November 28, 2022 02:18 AM UTC

Hi Sarveswaran,

This helped perfectly, thank you so much!

SG Suganya Gopinath Syncfusion Team November 29, 2022 07:21 AM UTC


We are glad that the issue has been resolved. Please get back to us for further assistance.

We are marking ticket as solved.


Suganya Gopinath.

Live Chat Icon For mobile
Up arrow icon