+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Filter Expression on Download List

Filter Expression on Download List

5 posts, 0 answered
  1. Reynaldo
    Reynaldo avatar
    10 posts
    Registered:
    25 Oct 2012
    27 Jan 2014
    Link to this post
    Two part question:

    #1 - I have a download list on a page that displays pdf documents from a Documents and Files library. Is there a way to dynamically update the filter expression on the Download List based on a click event by a user? The reason I ask is I have an A - B - C listing and when users click on the letter "A" only the pdf's that begin with the letter "A" should be displayed. When they click on the letter "B", only the documents that begin with "B" are displayed and so forth. 

    #2 - On the filter expression of the download list what should I add to return documents begining with a letter? Is there a Title.BeginsWith("A")? I have seen and used Title.Contains("A"), but that just returns all documents that have an "A" in their name.

    Thanks.

    Thanks.
  2. Reynaldo
    Reynaldo avatar
    10 posts
    Registered:
    25 Oct 2012
    28 Jan 2014 in reply to Reynaldo
    Link to this post
    Update:
    #2 - So using Title.StartsWith("A") and adding it to the FilterExpression property of the Document List lists only the documents that begin with the letter passed, in this case the letter A.

    Back to #1 - How do I pass the letter I want to filter by to the document list? Should I just build 20+ pages for each letter of the alphabet? Not wanting to go this route of course. Any suggestions?
  3. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    29 Nov 2016
    30 Jan 2014
    Link to this post
    Hi Reynaldo,

    In order to achieve your needs you need to update the WidgetTemplate.

    You could list all the documents and implement some JavaScript logic to hide the files you do not need on the page. This is under: Download List widget > Edit menu > Settings > Edit thumbnail list template.
    Add a TextBox and a Button on the template for example and adding at the end your JavaScript logic:
    <script type="text/javascript">
      // implement your logic here
    </script>

    Alternatively, you could do this by extending the server-side logic in the template code behind. To do so you need to:
    - Create a new WebUserControl - for the mark-up get the code for the template you need under: Download List widget > Edit menu > Settings > Edit thumbnail list template.
    - Add the code behind logic you need
    - Build the solution
    - Map this new template (in the example below 'MasterListView' for selected type 'List')
    Short video demonstration could be found here.

    Than you need to add your logic for filtering or searching in the code behind and build the solution. In addition, for query documents you could check this article.

    Regards,
    Svetoslav Manchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Reynaldo
    Reynaldo avatar
    10 posts
    Registered:
    25 Oct 2012
    30 Jan 2014 in reply to Svetoslav Manchev
    Link to this post

    Thanks for the reply Svetoslav.

    The first option we have already implemented and hide/display documents based on user click of a link with CSS and JS. The caveat to that was that it would only filter the documents on the current page and our client has 800+ documents that we are filtering thru. So displaying them all on one page was not to their liking and paging was requested to list the documents. I'll look at your alternate solution and see if I may go that route.

    Thanks for your help!

  5. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    29 Nov 2016
    31 Jan 2014
    Link to this post
    Hello Reynaldo,

    Thank you for your feedback.

    Please do not hesitate to get back to me if any problems persist, I'll be glad to assist you further.

    Regards,
    Svetoslav Manchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
5 posts, 0 answered