Is it possible to Change Filter Template combo box Selected value from Client side within RadGrid?

2 posts, 0 answers
  1. Ronak
    Ronak avatar
    8 posts
    Member since:
    Apr 2011

    Posted 06 Apr 2012 Link to this post

    Hi all,

    Right now, I am facing a problem with my Filter Template.
    I have studied this  link .
    It is good example.
    But my problem is that one of my column has some different condition.
    The combo box has 4 value (i.e. New, In Progress, Near completion, Closed). it is filled by data source SDSStatus & two more items are added i.e. "All" & "Open Only".
    Now, Suppose If I am select Open Only from combo,except "Closed" records all other records should be displayed in grid. 
    Actually, I want to know that, Is it possible to filter like this way? 
    Please help me its urgent.
    see below code.  ( That is what I am thinking ).

    <telerik:GridBoundColumn DataField="StatusName" HeaderText="Status Name" SortExpression="StatusName"
                                      UniqueName="StatusName"  >
                              <telerik:RadComboBox ID="RadComboBoxSts" DataSourceID="SDSStatus" DataTextField="StsName"
                                  DataValueField="StsName" Skin="Office2007" Width = "100%" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("StatusName").CurrentFilterValue %>'
                                  runat="server" OnClientSelectedIndexChanged="StsIndexChanged">
                                      <telerik:RadComboBoxItem Text="All"/>
                                                   <telerik:RadComboBoxItem Text="Open Only"/> 
                              <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
                                  <script type="text/javascript">
                                      function StsIndexChanged(sender, args) {
                                      var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    If(args.get_item().get_text() == "Open Only")
                                          tableView.filter("TaskTypeName", "Closed", "NotEqualTo");
                                                       // Combo selected text must be Open Only after filtering.
                                          tableView.filter("TaskTypeName", args.get_item().get_value(), "EqualTo");
                                      <HeaderStyle  Width = "6%" VerticalAlign ="Top"/>
                                      <ItemStyle  Width = "6%" VerticalAlign ="Top"/>

  2. Tsvetina
    Tsvetina avatar
    2481 posts

    Posted 11 Apr 2012 Link to this post

    Hello Ronak,

    As long as the column is bound to a data field that contains the respective values, more specifically "Closed", it is fine to filter by them and your code seems to be correct for such case.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top