Search code examples
c#winformsdatagridviewcomboboxcolumn

AdvancedDataGridView crashes on ComboBoxColumn filtering c# WinForm


I use the AdvancedDataGridView nuget and I face a problem I can't resolve... The filtering is working on every columns except the DataGridViewComboBoxColumn that crashes when I'm filtering it.

My FilterStringChanged event code :

void DGV_ManquantsFilterStringChanged(object sender, EventArgs e)
    {
        Bdd bdd = new Bdd();
        DataTable dt = (DataTable)DGV_Manquants.DataSource;
        dt.DefaultView.RowFilter = DGV_Manquants.FilterString;
        DGV_Manquants.DataSource = dt;

         //Generate Data from a txt File 
        foreach(DataGridViewRow r in DGV_Manquants.Rows){
            r.Cells["Qui"].Value= bdd.searchThisDataBy2(r.Cells["of"].Value.ToString().Trim(),
            r.Cells["code_article"].Value.ToString().Trim(),
            "OF_COD", "ART_COD","Qui",this.infoArtTxtPath);
        }

        bdd.generateTxtData(this.DGV_Manquants);
        DGV_Manquants.Columns["total_manquants"].Visible=false;
        DGV_Manquants.Columns["Id"].Visible=false;
        colorUpdate();

    }

Using this, the error code it gaves me on line 3 (for an empty filter) :

System.Data.SyntaxErrorException:  The expression contains an invalid string constant : '[] IS NULL)'.

I can't find a way to handle the fact that it is a comboboxColumn...

Thanks in advance,


Solution

  • I had to modify "DataPropertyName" to "Name" in several places of the file ColumnHeaderCell of the Library, it's now working.