Issue with FIlterExpression of RadGrid using toggle button in FIlter template

4 posts, 0 answers
  1. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 31 Jul 2014 Link to this post

    Hello Team,

    I am working on Web Application. used FIlterTemplate in GridBoundColumn of RadGrid.

    Placed RadButton in Filter template with Toggle type : "CustomToggle" and ButtonType : "ToggleButton".

    In preRender Event of Radgrid, I found grid.mastertableview.FIlterExpression is Empty.

    Please find below Script used OnClientToggleStateChanged :

    <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
    <script type="text/javascript">
    function ToggleStateChanged(sender, args) {
    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
    if (args._currentToggleState._attributes.text == "All") {
      tableView.get_filterExpressions().clear();
    }
    else {
       tableView.filter("UserName", "<%= Context.User.Identity.GetUserName() %>", "EqualTo");                                                                                }
    }
    </script>
    </telerik:RadScriptBlock>  

    Can anyone help me out? stuck with a simple filter functionality.

    Thanks and Regards,
    Ruchi Patel







  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 05 Aug 2014 Link to this post

    Hi Ruchi,

    To achieve this behavior, you can filter the column with empty value or NoFilter function as demonstrated in this live sample:
    http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/filter-templates/defaultcs.aspx

    Hope this helps.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 05 Aug 2014 in reply to Eyup Link to this post

    Hello Eyup,

    Thank you for the reply.

    I tried the same as well. but on code behind i didn't get the Filter expression.

    as mentioned in example you send:
      protected void RadGrid1_PreRender(object sender, System.EventArgs e)       
    {           
    if (RadGrid1.MasterTableView.FilterExpression != string.Empty)           
    {               
    RefreshCombos();           
    }       
    }       
    protected void RefreshCombos()      
     {           
    SqlDataSource2.SelectCommand = SqlDataSource2.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString();           
    }

    getting "RadGrid1.MasterTableView.FilterExpression" as Empty.

    Thanks and Regards,
    Ruchi Patel
  5. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 08 Aug 2014 Link to this post

    Hello Ruchi,

    Can you please send us sample screenshots or video demonstrating your initial request and the exact desired behavior? Thus, we will be able to figure out your specific requirement and send a sample web site to demonstrate how you can achieve it.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top