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

filter using radcombobox

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erin
Top achievements
Rank 1
Erin asked on 15 Oct 2013, 01:49 PM
Hi,
I want to filter using radcombobox.the dropdown should contain all data and the option All and Null.
How to obtain this?

Thanks,
Erin. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Oct 2013, 01:57 PM
Hi Erin,

Please try the following code snippet.Hope this helps.

ASPX:
<telerik:GridBoundColumn DataField="ShipCity" FilterControlAltText="Filter ShipCity column"
    HeaderText="ShipCity" SortExpression="ShipCity" UniqueName="ShipCity">
    <FilterTemplate>
        <telerik:RadComboBox ID="Status" DataSourceID="SqlDataSource1" DataTextField="ShipCity"
            DropDownWidth="200px" DataValueField="ShipCity" Height="100px" AppendDataBoundItems="true"
            Skin="Windows7" SelectedValue='<%# Container.OwnerTableView.GetColumn("ShipCity").CurrentFilterValue %>'
            runat="server" OnClientSelectedIndexChanged="StatusIndexChanged" AllowCustomText="false">
            <Items>
                <telerik:RadComboBoxItem Text="All" />           
                <telerik:RadComboBoxItem Text="IsNull" Value="Null" />
            </Items>
        </telerik:RadComboBox>
        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
            <script type="text/javascript">
                function StatusIndexChanged(sender, args) {
                    var tableView = $find("<%# Container.OwnerTableView.ClientID %>");
                    var value = args.get_item().get_value();
                    if (value == "Null") {
                        tableView.filter("ShipCity", args.get_item().get_value(), "IsNull");
                    }
                    else {
                        tableView.filter("ShipCity", args.get_item().get_value(), "EqualTo");
                    }
                }
            </script>
        </telerik:RadScriptBlock>
    </FilterTemplate>
</telerik:GridBoundColumn>

Thanks,
Shinu
Tags
Grid
Asked by
Erin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or