RowFilter using combobox in c#

40 Views Asked by At

I have a problem in index 2 of the combobox, it filters correctly in index 0, 1 and 3, but in index 2 it does not return any data since there is data for it returns, and I realized that if I change the "Expired" to "Valid " or "Request purchase" it returns correctly, it just doesn't return "Overdue".I've tried everything to figure out the problem and I still haven't had any progress.

    `if (combo.SelectedIndex == 1)
    {
        string text = txtProcurar.Text;
        dtgridreagentes.DataSource = reagente.ListarReagentes(txtProcurar.Text);
        LoadDatagrid();
        ConfigurarDataGrid();
        DataView pp = (dtgridreagentes.DataSource as DataTable).DefaultView;
        pp.RowFilter = string.Format("Stats = '{0}'", "Válido", text);
    }

    if (combo.SelectedIndex == 2)
    {
        string text = txtProcurar.Text;
        dtgridreagentes.DataSource = reagente.ListarReagentes(txtProcurar.Text);
        LoadDatagrid();
        ConfigurarDataGrid();
        DataView pp = (dtgridreagentes.DataSource as DataTable).DefaultView;
        pp.RowFilter = string.Format("Stats = '{0}'", "Vencido", text);
    }

    if (combo.SelectedIndex == 3)
    {
        string text = txtProcurar.Text;
        dtgridreagentes.DataSource = reagente.ListarReagentes(txtProcurar.Text);
        LoadDatagrid();
        ConfigurarDataGrid();
        DataView cc = (dtgridreagentes.DataSource as DataTable).DefaultView;
        cc.RowFilter = string.Format("Stats = '{0}'", "Solicitar compra", text);
    }
}`
0

There are 0 best solutions below