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

issue in clearing Combobox in Filtertemplate

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pravin Magdum
Top achievements
Rank 1
Pravin Magdum asked on 13 May 2010, 03:49 PM
hello all,
i have radgrid with radcombobox in filtertemplate 

it works fine 

but on clear filter button  i rebind grid upto this everything is fine and i manged to clear all filter text box to set empty 

but my radcombo is not reset on clear button click 

how can i achive this 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 May 2010, 08:02 AM
Hi Pravin,

Try accessing the RadComboBox placed in FilterTemplate and set SelectedIndex = 0 in order to achieve the functionality. Check out the code snippet in the clear Button_Click event below.

C#:
  
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            RadGrid1.MasterTableView.FilterExpression = String.Empty; 
            GridFilteringItem filter =(GridFilteringItem) RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0]; 
            RadComboBox comboBoxItem = (RadComboBox)filter.FindControl("RadComboBox1"); 
            if (comboBoxItem != null
                comboBoxItem.SelectedIndex = 0;          
        } 

ASPX:
 
<FilterTemplate> 
    <telerik:RadComboBox AppendDataBoundItems="true" DataTextField="OrderID" DataValueField="OrderID" DataSourceID="SqlDataSource2" 
        ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
        <Items> 
            <telerik:RadComboBoxItem Text="" /> 
        </Items> 
    </telerik:RadComboBox> 
</FilterTemplate>  
 


Regards,
Princy.
Tags
Grid
Asked by
Pravin Magdum
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or