This is a migrated thread and some comments may be shown as answers.

Can I call one FilterExpression to All Controls

0 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Appu
Top achievements
Rank 1
Appu asked on 08 Jul 2009, 11:38 AM
Hi
     I am using Radgrid having filtering controls. I used to call each filter control event at code behind. But theproblem is i could get filtered data only from the last control event fired,though i preserved the first control value it didnt take an account that value by the last control event value only taken.

So i need the filtering based on all control values even though i used to select randomly

My cs code:

//First Combo
protected void JurisdictionCodeComboBox_IndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string filterExpression = "";
        string query = "";

        if (e.Text.IndexOf(",") > -1)
        {
            string[] values = e.Text.Split(',');

            for (int i = 0; i < values.Length; i++)
            {
                query += "'" + values[i] + "',";
            }

            query = query.Remove(query.Length-1, 1);
        }
        else
        {
            query = "'" + e.Text + "'";
        }
        if (e.Value != "All")
        {
            filterExpression = "([JurisdictionCode] in (" + query + "))";
        }
        else
        {
            filterExpression = "([JurisdictionCode] <> '')";
        }
        hdnJurisdictionCode.Value = e.Text.ToString();
        RadGrid1.MasterTableView.FilterExpression = filterExpression;
       

    }

    //Second Combo
    protected void FergTechNumComboBox_IndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string filterExpression = "";
        string query = "";

        if (e.Text.IndexOf(",") > -1)
        {
            string[] values = e.Text.Split(',');

            for (int i = 0; i < values.Length; i++)
            {
                query += "'" + values[i] + "',";
            }

            query = query.Remove(query.Length - 1, 1);
        }
        else
        {
            query = "'" + e.Text + "'";
        }
        

        if (e.Value != "All")
        {
            filterExpression = "([FergTechNum] in (" + query + "))";
        }
        else
        {
            filterExpression = "([FergTechNum] <> '')";
        }
        hdnFergTechNum.Value = e.Text.ToString();
        RadGrid1.MasterTableView.FilterExpression = filterExpression;
      
    }
   

Appu

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Appu
Top achievements
Rank 1
Share this question
or