RadGrid filtering by the RadComboBox which is outside the grid

1 posts, 0 answers
  1. Константин
    Константин avatar
    8 posts
    Member since:
    Jul 2017

    Posted 15 May 2018 Link to this post

    I tried this code to filter radgrid from the external radcombox located outside the Grid. And i have a problem with it. Visual Studio debugger and SQL Profiler show that this code works and send to radgrid correct filter expression with the correct filter value. But radgrid doesn't filtrate data with this expression while rebinding. It shows all data without any filtering after rebinding. How can I solve it?

    This is my code C#:

    protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        radgrid.MasterTableView.FilterExpression = "[service_id] LIKE '%" + ddlService.SelectedValue + "%' ";
        GridColumn column = radgrid.MasterTableView.GetColumnSafe("serv_id");
        column.CurrentFilterFunction = GridKnownFunction.EqualTo;
        column.CurrentFilterValue = ddlService.SelectedValue;
        column.AndCurrentFilterFunction = GridKnownFunction.EqualTo;
        radgrid.MasterTableView.Rebind();
    }

     

    This is my ASPX code with combox setting:

    <telerik:RadComboBox ID="ddlService" runat="server" Height="200" Width="240"
      DropDownWidth="310"  DataSourceID="dsServices"
     EmptyMessage="- Select Product -"
    HighlightTemplatedItems="true" CausesValidation="false"
    Filter="Contains" AppendDataBoundItems="true"
    onselectedindexchanged="RadComboBox1_SelectedIndexChanged"
    SelectedValue='<%# radgrid.MasterTableView.GetColumn("serv_id").CurrentFilterValue %>'
    AllowCustomText="true" AutoPostBack="true" DataTextField="service_name" DataValueField="id"
    >
Back to Top