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

Filter Template

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 1
Andy Green asked on 10 Jun 2010, 12:06 PM
Hi

I'm using the filter template and have a radComboBox with a select to display a list of options. What I'm doing id populating the gid with a call to a database, then populating the combobox with another call to the database.

Is it possible to populate the combobox from the already downloaded grid data, this would serve 2 purposes, 1 - one less database call and 2 - the combo box would only have that data which exists in the grid whtout a complcated where clause.

Andy

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Jun 2010, 01:32 PM
Hello Andy,

I have one suggestion regarding this.

In the NeedDataSource event of RadGrid, get the DataTable and save the required field values in a globally accessible variable. Then in the ItemDataBound event, access the RadComboBox placed in FilterTemplate and set the DataSource from code.

The code snippet shows, how to access the control in FilterTemplate.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridFilteringItem) 
        { 
            GridFilteringItem filterItem = (GridFilteringItem)e.Item; 
            RadComboBox combo = (RadComboBox)filterItem.FindControl("RadComboBox1"); 
            // set DataSource here 
        } 
    } 


-Shinu.
Tags
Grid
Asked by
Andy Green
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or