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

Getting Filter Control in FilterTemplate

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Spencer
Top achievements
Rank 1
Spencer asked on 02 Jan 2013, 05:56 PM

I'm trying to databind a combobox for a filter on a radgrid. I can't seem to be able to find the filter control when i try the following, nothing happens.

foreach (GridFilteringItem filterItem in InitAlerts.MasterTableView.GetItems(GridItemType.FilteringItem))
{
    RadComboBox initLoans = (RadComboBox)filterItem.FindControl("InitLoan");

    var loannumber = (from DataRow dRow in initTable.Rows
                        select new { loan_number = dRow["loan_loan_number"] }).Distinct().ToList(); 

    initLoans.DataSource = loannumber;
    initLoans.DataBind();
    Label1.Text = initLoans.ID.ToString();
}

Also, this is just running in Page_Load, if that makes a difference...

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jan 2013, 04:14 AM
Hi,

Try accessing the control in ItemDataBound event as shown below.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if(e.Item is GridFilteringItem)
 {
   GridFilteringItem filterItem = (GridFilteringItem)e.Item;
   RadComboBox initLoans = (RadComboBox)filterItem.FindControl("InitLoan");
 }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Spencer
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or