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

Filter Grid from a public property that comes from a controll

1 Answer 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 2
Nikola asked on 19 Sep 2014, 08:17 AM
I have a public property witch looks like this
public string SelectedCountry
{
get { return this.cmbCountry.SelectedValue; }
}
Where i receive what the user has selected in the RadComboBox.

Now I want to filter my gird by this selected value how can I do this ?

On the gird page I prepared method like this witch is triggered when the user clicks on a button (apply filter)

protected void Af_FilterButtonClicked(object sender, EventArgs args)
{
jobFilter.SelectedCountry.Where() //jobFilter is my custom control
}

I thought that I have to do something like this ?Thanks for help and fast answer !

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 24 Sep 2014, 06:14 AM
Hi Nikola,

In order to filter the gird you can use one of the below listed techniques.
  • If the grid uses advanced data-binding you can filter the data source using the selected country prior to passing it to the grid.
  • One can create a filter expression manually as explained in this help article.
  • If the grid has enabled filtering you can try firing a filter command as shown below
    GridFilteringItem filterItem = (RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem);
           RadGrid1.MasterTableView.GetColumnSafe("ColumnUniqueName").CurrentFilterValue = "Company10";
           filterItem.FireCommandEvent("Filter", new Pair("EqualTo", "ColumnUniqueName"));

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Nikola
Top achievements
Rank 2
Answers by
Angel Petrov
Telerik team
Share this question
or