SfGrid Edit/Add custom Dropdownlist

Hi guys

I am having some problems with it...

What I need to do is, display a list of Orders

<GridColumn Field=@nameof(Order.Id) Visible="false" IsPrimaryKey="true"></GridColumn>

 <GridColumn Field=@nameof(Order.Name) ></GridColumn>

<GridColumn HeaderText="Order Type">

                                        <Template Context="ecContext">

                                            @{

                                                var item = (ecContext as Order);

                                                <text>@item.OrderType.Name</text>

                                            }

                                        </Template>

                                    </GridColumn>


Id, Name, OrderType.Name

This OrderType is a child (FK) from Order table with list of OrderType [{1,Debit}, {2,Credit}, {3, Online}]
when user is add/edit an item how to display a dropdownlist with OrderType options but when the user selects it, it will be displaying the OrderType.Name but also saving the Order.OrderTypeId?

I would like to display a modal with it


1 Reply

SP Sarveswaran Palani Syncfusion Team April 29, 2022 11:59 AM UTC

Hi Douglas,

 

Greetings from Syncfusion Support.

 

Query: "SfGrid Edit/Add custom Dropdownlist".

 

We have analyzed your query and we can achieve your requirement using “ForeignKeyField” feature of Grid. Using this feature, we can display the data from another table which has foreign key relation between them.

 

Refer our UG documentation for your reference

 

https://blazor.syncfusion.com/documentation/datagrid/columns#foreign-key-column

 

Refer our Demo Link as well   

https://blazor.syncfusion.com/demos/datagrid/foreign-key-column?theme=fluent

 

Please get back to us if you have further queries.

 

Regards,

Sarveswaran PK


Loader.
Up arrow icon