Problem with datagridview filtering RRS feed

  • דיון כללי

  • Hello - 


    I'm trying to filter a datagridview using a BindingSource

    I have a combo in my form that hold a Category Values: m_cFilterByCategoryCombo

    I have a datagridview : m_cSTDTeleDataGridView

    it is in a pagetab

     the combo is in the pagetab as well.

    the botton m_cFilter activatre the filter

    I use this code to filter.

    private void m_cFilter_Click(object sender, EventArgs e)

          string myFilter = string.Format("CCategory = '{0}'", m_cFilterByCategoryCombo.SelectedValue);
          BindingSource bsSTDTele = new BindingSource();
          bsSTDTele.DataSource = m_cSysSetting.CSTDTeleSettings.CParamList;
          bsSTDTele.Filter = myFilter;
          m_cSTDTeleDataGridView.DataSource = bsSTDTele;

    when i check the bsSTDTele.SupportsFiltering it is FALSE

    and i think the list is not filterable.

    am i right ?

    if i am. is there a way to make this list filterable ???

    If I'm doing it all wrong and the logic is different - please let me know as well...

    Thank you very much...





    יום שלישי 29 מרץ 2011 13:45

כל התגובות

  • i would like to share with u my exp with dgv

    i got myself a DataTable (from a db) and started filtering it with Linq

    the results were hazardus at first - the columns were the DataRow's prop and when i wanted to take it back again to refilter it was even more of a problem


    i remembered that the datasource is an object so that means i can do this

    var query = from....

    dgv.datasource = query.CopyAsDataTabe((

    and whenever i want to requery

    var query = from current in ((DataTable)dgv.datasource).AsEnumerable()

    my conclusion - make ursesl a collection of a sort (list<>?) and recast it

    i had there 4 comboboxes and with each change i send all 4 events to 1 func to do all the filtering again from scrap and this linq is damn fast

    יום שישי 20 אפריל 2012 07:27
  • תנסה להוסיף בסוףm_cSTDTeleDataGridView.rebind()

    מכיוון שהוא מחזיר את הערכים של ה גריד מה viewstate

    יום ראשון 22 אפריל 2012 12:59