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

RadGrid filtering with JavaScript Ajax and Ajax History

1 Answer 53 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Lou asked on 14 Jan 2014, 07:36 PM
Hello. I am tring to get a grid to filter based on a drop down selection. I have this working fine, except when the page is loaded from a history point.
Below is one of the columns in the my grid. Note the Java script within the RadScriptBlock5.


<telerik:GridTemplateColumn DataField="Sale Price" HeaderText="Price" SortExpression="Sale Price" UniqueName="SalePrice">
      <telerik:RadComboBox ID="RadComboBoxSalePrice" runat="server" AppendDataBoundItems="true"
       EnableScreenBoundaryDetection="false" ExpandDirection="Down" DataSourceID="SalePriceDataSource" DataTextField="Sale Price"
       DataValueField="Sale Price Numeric" Height="220px" MarkFirstMatch="true" NoWrap="True"
       OnClientDropDownOpening="OnClientItemsRequestedHandler" OnClientItemsRequested="OnClientItemsRequestedHandler"
       SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("SalePrice").CurrentFilterValue%>'
       Sort="Ascending" SortCaseSensitive="False" Width="70px">
           <telerik:RadComboBoxItem Text="All" />
        <telerik:RadScriptBlock ID="RadScriptBlock5" runat="server">
      <script type="text/javascript">
        function SalePriceIndexChanged(sender, args) {
            var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
            tableView.filter("SalePrice", args.get_item().get_value(), "EqualTo");
    <br />
    <div style="height: 35px; margin-top: 5px;">
       <asp:ImageButton runat="server" ID="btnClear" ImageUrl="~/images/used equipment clear button.gif" OnClick="btnClear_Click" />
    <%# Eval("Price Combo")%>
    <ItemStyle HorizontalAlign="Right" Width="70px" />
    <HeaderStyle HorizontalAlign="Right" Width="70px" />
When the use navigates away from the page, and returns to the page, using the history navigation
I get the following error:

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; xs-ivyEL6bAur8;Cm8Afr; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Timestamp: Tue, 14 Jan 2014 19:35:52 UTC
Message: 'SalePriceIndexChanged' is undefined
Line: 247648215
Char: 5
Code: 0

This java script is wrapped in RadScriptBlock.

Any ideas how to resolve this?

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 15 Jan 2014, 12:57 PM
I resolved this by moving the filtering into the code behind.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question