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

Problem using FilterTemplate with JS

1 Answer 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 2
Nikola asked on 02 May 2013, 11:44 AM

Story:

I'm trying to do some filtering with JavaScript I'have a grid and in this grid I want to filter some values using Combo Boxes . So far the values are displayed in the Combo Boxes etc.. and it is already working for one .

Question:

My problem is don't get it why is it not working for my second example.. I always get this strange error

The argument types 'Edm.Int32' and 'Edm.String' are incompatible for this operation. Near equals expression, line 6, column 19.

This example works fine

                <telerik:GridTemplateColumn DataField="ActivityId" FilterControlAltText="Filter ActivityId column"
                    HeaderText="Activity" SortExpression="ActivityId" UniqueName="ActivityId">
                    <ItemTemplate>
                        <asp:Literal runat="server" Text='<%# Eval("Activity.FullActivity") %>' />
                    </ItemTemplate>
                    <FilterTemplate>
                        <telerik:RadComboBox runat="server" DataSourceID="dsActivity" DataTextField="FullActivity" DataValueField="ActivityId"
                            SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ActivityId").CurrentFilterValue %>'
                            Height="200px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="TitleIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Value="0" Text="- All -" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="rsbActivity" runat="server">
                            <script type="text/javascript">
                                function TitleIndexChanged(sender, args) {
                                    //alert(args.get_item().get_value());
                                    if (args.get_item().get_value() > 0) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("ActivityId", args.get_item().get_value(), "EqualTo");
                                    } else {
                                        tableView.filter("ActivityId");
                                    }
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridTemplateColumn>

And in this one its not working ...

   <telerik:GridTemplateColumn DataField="Dossier.LBUId" HeaderText="LBU" FilterControlAltText="Filter Dossier.LBUId column"
                            SortExpression="LBUId" UniqueName="LBUId">
                            <ItemTemplate>
                                <asp:Literal ID="Literal3" runat="server" Text='<%# Eval("Dossier.LBU.Code") %>' />
                            </ItemTemplate>
                            <FilterTemplate>
                                <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="dsLBU" DataTextField="Code" DataValueField="LBUId"
                                    SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("LBUId").CurrentFilterValue %>'
                                    Height="200px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="ChangeLbuCode">
                                    <Items>
                                        <telerik:RadComboBoxItem Value="0" Text="- All -" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="ChangeLbuCode" runat="server">
                                    <script type="text/javascript">

                                        function ChangeLbuCode(sender, args) {
                                            if (args.get_item().get_value() > 0) {
                                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                tableView.filter("LBUId", args.get_item().get_value(), "EqualTo");
                                            } else {
                                                tableView.filter("LBUId");
                                            }
                                        }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridTemplateColumn>

Thanks for help and fast answer !!

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 07 May 2013, 10:18 AM
Hi Nikola,

You need to have consistent datatype. Check the values and datatype in the ComboBox dataSet and what you pass in the parameter of the  RadGrid's DataSource and verify if they are equal.

All the best,
Maria Ilieva
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.
Tags
Grid
Asked by
Nikola
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or