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

RadCombobox in FilterTemplate RadGrid

1 Answer 62 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Benny
Top achievements
Rank 1
Benny asked on 30 Jun 2010, 08:22 AM
Hi,

I've added a RadComboBox in the FilterTemplate of a RadGrid.

<FilterTemplate> 
    <telerik:RadComboBox  
        ID="filterNationalities"  
        DataSourceID="dbNationalities"  
        DataValueField="ID"  
        DataTextField="description"  
        AutoPostBack="false"  
        runat="server" 
        AppendDataBoundItems="true" 
        SelectedValue='<%#((GridItem)Container).OwnerTableView.GetColumn("NationalityID").CurrentFilterValue %>' 
                               OnClientSelectedIndexChanged="FilterByNationality"  
                                            OnItemCreated="TranslateNationalities" 
         Width="75" 
         ZIndex="10000000"
             <Items> 
                 <telerik:RadComboBoxItem /> 
             </Items> 
</telerik:RadComboBox> 
                                             
                                            <telerik:RadScriptBlock  ID="scriptFilterNationality"  runat="server"
                                                <script type="text/javascript"
                                                    function FilterByNationality(sender, args) { 
                                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); 
                                                        tableView.filter("NationalityID", args.get_item().get_value(), "EqualTo"); 
                                                    } 
                                                </script> 
                                            </telerik:RadScriptBlock> 
                                        </FilterTemplate> 

This RadCombobox is bound to a <asp:SqlDataSource ID="dbNationalities" runat="server" />.
Everything works fine but I want to translate the items of the RadCombobox.
I'm using OnItemCreated:

protected void TranslateNationalities( object sender, RadComboBoxItemEventArgs e ) { 
        RadComboBoxItem dataItem = e.Item; 
        dataItem.Text = "translate text"
 

But this doesn't work. Can I change the text of the items if this is bind to a datasource?
Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Jun 2010, 08:49 AM
Hello,

I believe, if you have tried the code in ItemDataBound event than ItemCreated, you could have got this working.


-Shinu.
Tags
ComboBox
Asked by
Benny
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or