ListView Filtering Always Returns No results

2 posts, 0 answers
  1. Chris
    Chris avatar
    16 posts
    Member since:
    Mar 2007

    Posted 21 Mar Link to this post

    I have not been able to figure out why I am not getting the filter results I am expecting. In fact I always get no results.

    When the page first loads all the data is displayed as expected.

    When I enter as search query and click the Search button the RadListView control refreshes with no results. I see the spinner so I know it posted back via AJAX.

    I debug the C# code and I can confirm that the search query value is passed to the BuildExpression for the filter. No errors or exceptions are thrown.

    If I submit an empty query it should just Clear the Filter and all results should show, but that does not happen.

    The datasource is a List<DeviceSearchResult>.

    Any ideas?

    Here is my markup:

    <asp:Panel ID="pnlSearchView" runat="server" Visible="True">
        <h1>Search View</h1>
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
                <telerik:AjaxSetting AjaxControlID="txtDeviceSearchQuerySubmit">
                        <telerik:AjaxUpdatedControl ControlID="lvDeviceSearchResults" />
           <asp:TextBox ID="txtDeviceSearchQuery" runat="server"></asp:TextBox>
        <asp:Button ID="txtDeviceSearchQuerySubmit" runat="server" OnClick="txtDeviceSearchQuerySubmit_OnClick" Text="SEARCH"/>
        <telerik:RadListView ID="lvDeviceSearchResults" RenderMode="Lightweight" runat="server"
                <asp:PlaceHolder ID="phDeviceSearchResult" runat="server"></asp:PlaceHolder>
                <%# ShowGroupRow(Eval("DeviceManufacturer").ToString())=="yes"
                        ? "<div class=\"manufacturer\"><strong>"+Eval("DeviceManufacturer")+"</strong></div>"
                        : ""  %>
                <div>- <%# Eval("DeviceName") %> | <%# Eval("DevicePackage") %> | <%# Eval("DevicePin") %></div>
                <asp:ListView ID="lvDeviceSearchResultAdapters" runat="server" ItemPlaceholderID="phDeviceSearchResultAdapters" DataSource='<%# Eval("DeviceAdapters") %>'>
                        <ul><asp:PlaceHolder ID="phDeviceSearchResultAdapters" runat="server"/></ul>
                        <li><%# Container.DataItem.ToString() %></li>


    Here is my C#:

    protected void lvDeviceSearchResults_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
        lvDeviceSearchResults.DataSource = TempDeviceSearchResults.OrderBy(d => d.DeviceManufacturer).ThenBy(d =>d.DeviceName);
    protected void txtDeviceSearchQuerySubmit_OnClick(object sender, EventArgs e)
        var query = txtDeviceSearchQuery.Text.Trim();
        if (!string.IsNullOrEmpty(query))
            lvDeviceSearchResults.FilterExpressions.BuildExpression(ex => ex
                .Contains("DeviceName", query)

  2. Chris
    Chris avatar
    16 posts
    Member since:
    Mar 2007

    Posted 22 Mar in reply to Chris Link to this post

    I found the problems. There were actually a few and none to do with the code above. One issue was with the use of the RadAjaxManager and DNN (I did not need to use it). The other was with the use of RadAutoCompleteBox. I was just using the .Text property of the control which included a semi-colon ";" at the end of the entered text which I missed during debugging.
  3. DevCraft R3 2016 release webinar banner
Back to Top