Elements not visible in the template filter of radcombobox

2 posts, 0 answers
  1. TomShelby
    TomShelby avatar
    4 posts
    Member since:
    May 2019

    Posted 17 May Link to this post

    Hi,

    I have a RadGrid with a radcombobox for the filter template. In the ASPX code I have the following:

     

    <telerik:GridTemplateColumn DataField="ID_Tipo" UniqueName="ID_Tipo" <br>  
    HeaderText="Tipo Usuario" DataType="System.string" FilterControlWidth="150px" <br>                        SortExpression= "ID_Tipo"
    <br>                        GroupByExpression="TipoUsuario Group by TipoUsuario"><br>                            <ItemTemplate><br>
                                    <%#DataBinder.Eval(Container.DataItem, "TipoUsuario")%><br>                            </ItemTemplate><br
    <FilterTemplate><br
    <telerik:RadComboBox ID="RCB_Filtro"<br>                                    Height="200px"<br>                                    OnClientSelectedIndexChanged="TipoUsuarioIndexChanged"<br>                                    DataSourceID="SqlDataSource1"<br>                                   
    EnableAutomaticLoadOnDemand="True"<br>
    CurrentFilterFunction="Contains" <br>                                    AutoPostBackOnFilter="True"<br>                                   
    AppendDataBoundItems="true"<br>  
    SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Id_Tipo").CurrentFilterValue %>'<br>                                   
    DataTextField="TipoUsuario"
    DataValueField="ID_tipoUsuario"<br>                                   
    runat="server" <br>                                   
    EnableLoadOnDemand="True"><br>             
    <Items><br>                                    
        <telerik:RadComboBoxItem Text="Todos" Value="" /><br>                                   </Items><br>                               
    </telerik:RadComboBox><br>                           
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server"><br>                               
    <script type="text/javascript"><br>                                   
    function TipoUsuarioIndexChanged(sender, args) {<br>                                  
    var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");<br>                                   
    if (args.get_item().get_value() == "Todos") { tableView.filter("ID_Tipo", args.get_item().get_value(), "NoFilter");<br>                                    }<br>                                   
    else {<br>                                  
    tableView.filter("ID_Tipo", args.get_item().get_value(), "EqualTo");<br>                                 }<br>                           } <br>                                       
    </script><br>                           
    </telerik:RadScriptBlock><br>                       
    </FilterTemplate>

     

    The radcombobox has an associated SQlDataSource:

     

    <asp:SqlDataSource <br>        runat="server"<br>        ID="SqlDataSource1"<br>        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"<br>        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ID_tipoUsuario], [TipoUsuario] from [Tipos_usuario] ORDER By [TipoUsuario]"><br>    </asp:SqlDataSource>

     

    But when I run the application, only the "All" item appears in the radcombobox. And when the "All" item is removed from the selection window, then the elements of the table are also loaded.

    In the VB module there is no action defined for RadGrid_ItemDataBound or RadGrid_ItemCreated, since the load is done by SQLDataSource.

     

    You can help me to see what is wrong or what I lack in the radcomobox definition. Thank you

  2. TomShelby
    TomShelby avatar
    4 posts
    Member since:
    May 2019

    Posted 17 May Link to this post

    Hi,

    Already solved. This must be the combobox.

    <FilterTemplate><br>                                <telerik:RadComboBox ID="RCB_Filtro"<br>                                    Height="200px"<br>                                    OnClientSelectedIndexChanged="TipoUsuarioIndexChanged"<br>                                    DataSourceID="SqlDataSource1"<br>                                    AutoPostBackOnFilter="True"<br>                                    AppendDataBoundItems="true"<br>                                    SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("ID_Tipo").CurrentFilterValue %>'<br>                                    DataTextField="TipoUsuario" DataValueField="ID_tipoUsuario"<br>                                    runat="server" ><br>                                    <Items><br>                                        <telerik:RadComboBoxItem Text="Todos" Value="" /><br>                                    </Items><br>                                </telerik:RadComboBox><br>                            <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server"><br>                                <script type="text/javascript"><br>                                    function TipoUsuarioIndexChanged(sender, args) {<br>                                   var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");<br>                                    if (args.get_item().get_value() == "Todos") { tableView.filter("ID_Tipo", args.get_item().get_value(), "NoFilter");<br>                                    }<br>                                    else {<br>                                   tableView.filter("ID_Tipo", args.get_item().get_value(), "EqualTo");<br>                                 }<br>                           } <br>                                        </script><br>                            </telerik:RadScriptBlock><br>                        </FilterTemplate>
Back to Top