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

Forums / Developing with Sitefinity / filtering document libraries by querystring

filtering document libraries by querystring

2 posts, 0 answered
  1. Bart Welch
    Bart Welch avatar
    64 posts
    Registered:
    10 Jul 2009
    22 Apr 2010
    Link to this post
    We have PDF forms that are specific for each State.  Instead of creating a page for each state, I'd like to pass the state via querystring and then select the appropriate document libraries based on that querystring.  There will be two libraries to select documents from.  One has generic PDFs that are available for all states.  These PDFs are in a separate library.  And the second library will be state specific.  What would be the easiest way to accomplish this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    23 Apr 2010
    Link to this post
    Hello Bart Welch,

    By default the document files are shown by download list control. After you append the QueryString to the url with the proper data, you have to create a custom control that inherits from DownloadList. Inside your custom class override CreateChildControls and before calling the base apply ContentFilter

    ContentFilterBuilder filterBuilder = new ContentFilterBuilder(this);
     filterBuilder.AddFilter(new ContentFilterStatement("param", value, ContentFilter.Condition.Equal, ContentFilter.JoinType.And));

    by doing so you will filter the content list and your users should see the proper data.

    Another option is overriding CreateDataSource() method where you could return the items only for a certain library.

    var m = new ContentManager("Libraries");
    // parent ID is the library ID
    IList l = m.GetContent(0, 0, string.Empty, parentID);


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered