none
filtering a datagridview

    Question

  • I am trying to filter a datagridview based on the checked status of one of the columns. There are 2 checkbox columns in the datagrid: Booking and Cancelled.My code reads something like this

    private void btnFilter_Click(object sender, EventArgs e)

    {

    if (rbEnquiries.Checked == true)

    {

    bsEnquiry.Filter = "Booking = false";

    }

    else if (rbBooking.Checked == true)

    {

    bsEnquiry.Filter = "Booking = true";

    }

    else if (rbAll.Checked == true)

    {

    bsEnquiry.RemoveFilter();

    }

    else if (rbCancelled.Checked == true)

    {

    bsEnquiry.Filter = "Cancelled = 'true'";

    }

     

    }

    The problem is that the filter only works properly when it is evaluating a true value. When it evaluates a false value, (bsEnquiry.Filter = "Booking = false";) it doesnt return any record in spite of there being records that have a booking status of false ( unchecked).

    Tuesday, May 02, 2006 7:38 PM

Answers

All replies