This is a migrated thread and some comments may be shown as answers.

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

1 Answer 33 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ronak asked on 06 Apr 2012, 01:54 PM
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"/>


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 11 Apr 2012, 09:58 AM
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.
General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question