show enum in blazor grid directly

Hi Team,

I want to show enum field of my model in a grid column without explicitly creating a template with dropdown list. Is that possible? if so, can you please share the example. 


I see that there is an example here https://blazor.syncfusion.com/demos/datagrid/inline-editing?theme=fluent2 and the field is Orders.ShipCountry whose column is dropdown. How is this working? I tried the same but i could not get the dropdown in the grid column


1 Reply

PS Prathap Senthil Syncfusion Team July 18, 2024 03:22 PM UTC

Hi Teja,

Based on your requirement, we would like to clarify if you want to edit using the dropdown SfDropDownList. This is the possible way to handle enum type data in the grid column using the Edit Template feature of the Grid. Without an EditTemplate, it is not feasible to achieve your requirements. We have already documented this topic, kindly refer to the below documentation for your reference.
Reference: https://blazor.syncfusion.com/documentation/datagrid/editing#edit-enum-column


Regarding the query, “Orders.ShipCountry whose column is dropdown. How is this working,” when the ShipCountry column is a string type, set the edit type as Dropdown (EditType="EditType.DropDownEdit") so that the dropdown edit is shown. However, Enum-type values are not directly supported, and you must use the EditTemplate feature. Thanks for your understanding.


Regards,
Prathap Senthil


Loader.
Up arrow icon