child grid dropdown asp.net core - Hierarchy grid

how to add dropdown to  child grid  asp.net core - Hierarchy grid


@{

    var ReldblData = new Syncfusion.EJ2.DataManager

            {

                Url = Url.Action("DdlUrlDatasource", "Home"),

                Adaptor = "UrlAdaptor"

            };

}


@{


    var ChildGrid = new Syncfusion.EJ2.Grids.Grid()

            {

                DataSource = dblData,

                QueryString = "EmployeeID",

                Load = "load",

                Columns = new List<Syncfusion.EJ2.Grids.GridColumn> {

                    new Syncfusion.EJ2.Grids.GridColumn(){ Field="DepID", HeaderText="Dep ID", Width="120" },

                    new Syncfusion.EJ2.Grids.GridColumn(){ Field="HisRelationID", HeaderText="His Relation", Width="100" },

                    new Syncfusion.EJ2.Grids.GridColumn(){ Field="EnDependName", HeaderText="En Depend Name", Width="150" }

            },

            };

}



Attachment: CoreSqlDataGrid_9293136c.rar


3 Replies

PS Pavithra Subramaniyam Syncfusion Team March 18, 2025 01:52 PM UTC

Hi ADMIRAL PH,


Before proceeding with adding a dropdown to the child grid, we need some clarification on the requirements:


  1. Dropdown Usage: Should the dropdown be used only during editing, or should it always be a static dropdown visible in the grid?
  2. Enabling Editing: The current configuration does not have editing enabled in the child grid. Do you want to enable editing? If yes, which edit mode do you prefer—inline edit, dialog edit, or batch-edit?
  3. Dropdown Data Source: Should the dropdown options come from a remote API, database, or a static list?
  4. Field Mapping: Do you want the dropdown for the HisRelationID column, or should it be applied to another column?


Please provide these details so we can suggest the best approach for implementing the dropdown in your child grid.


Regards,

Pavithra S



AP ADMIRAL PH March 18, 2025 04:02 PM UTC

Thanks, I would like to clarify as follows:

1) Dropdown visible in the child grid and always editable any time showing a text value, not the ID

2) Editing is Enabled in the child grid 

3)  Dropdown Data Source: URL Adaptor

4)  Field Mapping: " HisRelationID" field yes


Image_1792_1742313612651


with crud datamanger like this

    var ReldblData = new Syncfusion.EJ2.DataManager

            {

                Url = Url.Action("DdlUrlDatasource", "Home"),

                Adaptor = "UrlAdaptor",

                update url = "somthing"

                delete url = "somthing"

            };




PS Pavithra Subramaniyam Syncfusion Team March 19, 2025 09:27 AM UTC

ADMIRAL PH,


You can render the DropDownList in grid editing by setting the “editType” as “dropdownedit” and customize the DropDownList using the “edit.params” property. Please refer to the below documentation link in which you can render DropDownList component in edit form with custom dataSource.


https://ej2.syncfusion.com/documentation/grid/editing/edit-types#customize-dropdownlist-control-of-dropdownedit-type

https://ej2.syncfusion.com/documentation/grid/editing/edit-types#provide-custom-data-source-for-dropdownlist-control


If you want to make the grid always editable, you can render the DropDownList inside the column template feature.


https://ej2.syncfusion.com/documentation/grid/editing/edit#how-to-make-a-grid-column-always-editable


Please get back to us if you need further assistance on this.


Loader.
Up arrow icon