RadCombobox in FilterTemplate RadGrid

2 posts, 1 answers
  1. Benny
    Benny avatar
    11 posts
    Member since:
    Jul 2012

    Posted 30 Jun 2010 Link to this post

    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!
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Jun 2010 Link to this post

    Hello,

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


    -Shinu.
Back to Top