Skip to content

How to set the default display text for GridComboBox column in WinForms DataGrid (SfDataGrid)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/how-to-set-the-default-display-text-for-grid-combobox-column-in-winforms-data-grid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to Set the Default Display Text for GridComboBoxColumn in WinForms DataGrid?

This sample illustrates how to set the default display text for GridComboBoxColumn in WinForms DataGrid (SfDataGrid).

In DataGrid, GridComboBoxColumn does not have direct support to display default text on it when there is no selected Item. You can change default text using SfDataGrid.DrawCell event.

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.DisplayText = "Select Item";
    }
}

Showing default display text for the GridComboBoxColumn

Requirements to run the demo

Visual Studio 2015 and above versions

About

How to set the default display text for GridComboBox column in WinForms DataGrid (SfDataGrid)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages