Combobox default value

Hello, I have implemented a combobox in a column and I need this combobox by default before the user selects the item, it shows the content of the observable list. It's not working for me because the combobox has no ID to link to the header row.


"By default, GridComboBoxColumn displays the value by using the MappingName property" ok, but the property has no binding to the row header.


1 Reply

VD Vasanthkumar Durairaj Syncfusion Team August 15, 2022 02:24 PM UTC

Hi Sergio Ayala,


We are little unclear with your scenario. But to display the default text in GridComboBoxColumn, please refer to the below code snippets and attached sample.

this.sfDataGrid.DrawCell += SfDataGrid_DrawCell; 

 

private void SfDataGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e) 

{ 

    if(e.Column.MappingName == "ShipCountry" && string.IsNullOrEmpty(e.DisplayText)) 

    { 

        e.Style.TextColor = Color.Gray; 

        e.DisplayText = "Select Item"; 

    } 

} 

 

Can you please provide the more information related to your query?       

        1. Provide more details about your scenario with illustrations?  

        2. Provide more details about your scenario with image illustrations?   

Regards,

Vasanthkumar D


Attachment: SfDataGrid_GridComboBoxColumn_DefaultText_199cd71c.zip

Loader.
Up arrow icon