Filter Template

2 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 10 Jun 2010 Link to this post


    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.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jun 2010 Link to this post

    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 

Back to Top