Hi, I'm using Winforms 20.2.0.40 and can't set programmatically FirstConditionComboBox.SelectedValue in a AdvancedFilter:
sfDataGridProdotti.FilterPopupShowing += sfDataGrid_FilterPopupShowing;
void sfDataGrid_FilterPopupShowing(object sender, FilterPopupShowingEventArgs e)
{
try
{
if (e.Column.MappingName == "Cognome")
{
e.Control.FilterPopupMode = FilterPopupMode.AdvancedFilter;
e.Control.AdvancedFilterType = AdvancedFilterType.TextFilter;
e.Control.FirstConditionComboBox.SelectedIndex = 7;
e.Control.FirstConditionComboBox.Text = "Contains";
e.Control.ImmediateUpdateColumnFilter = true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
this code dont change the default value "Equals" of first combobo
Hi Massimo,
Your requirement to change the default AdvancedFilter FirstConditionComboBox value
in SfDataGrid can be achieved by customizing the FilterPopupShown event.
Please refer to the below code snippet,
|
sfDataGrid1.FilterPopupShown += OnFilterPopupShown;
private void OnFilterPopupShown(object sender, Syncfusion.WinForms.DataGrid.Events.FilterPopupShownEventArgs e) {
try { if (e.Column.MappingName == "Cognome") { //here change the AdvancedFilter FirstConditionComboBox defult value e.Control.FirstConditionComboBox.SelectedIndex = 7; e.Control.FirstConditionComboBox.Text = "Contains";
}
} catch (Exception ex) { MessageBox.Show(ex.ToString()); } } |
API Link: https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.DataGrid.SfDataGrid.html#Syncfusion_WinForms_DataGrid_SfDataGrid_FilterPopupShown
UG Link: https://help.syncfusion.com/windowsforms/datagrid/filtering#skip-the-frozen-row-data-from-filtering
Please find the sample in the attachment and let us know if you have any concerns in this.
Regards,
Vijayarasan S
Hi Vijayarasan,
thank you very much. This solve my problem.
Hi Massimo,
If you are satisfied with our response, please mark it as an answer. Otherwise,
please let us know if you have any further queries on this. We are happy to
help you😊.
Regards,
Vijayarasan S