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

Forums / Developing with Sitefinity / ImageGallery and CategoryTrees - display no images if no category selected

ImageGallery and CategoryTrees - display no images if no category selected

3 posts, 0 answered
  1. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    11 Jun 2009
    Link to this post
    Hi, I am trying to do something that I thought would be basic, but either I am missing something or what I am trying to do can only be done by extending the controls.

    I have a CategoryTree and a ImageGallery on the page. I have configured them both to use the same provider (library) and CategoryKeyID. Everything is fine once a category is selected, but it is the inital state that is the problem. When first loading the page all images in the library are displayed until a category is selected. Is there a way to make the ImageGallery display nothing if no Category is selected?

    Also, and this is just for future reference, would it be possible to achieve this loading of categories and images via a AJAX request, or is a postback required? If so how do I configure the AJAX Manager to do this?

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Jun 2009
    Link to this post
    Hi Nigel,

    Is there a way to make the ImageGallery display nothing if no Category is selected?

    Go to Advanced tab of ImageGallery control >> Filters. Then set content items filtering to non existing value of an operand. Example: Category = "blablabla". Thus when the control is loaded it will not find any items from specified category in the filter.

    Also, and this is just for future reference, would it be possible to achieve this loading of categories and images via a AJAX request, or is a postback required? If so how do I configure the AJAX Manager to do this?

    We use post back due to changing of the url. There is possible way, but it is not an easy one. You should create a completely new presentation mode and use js as it is done for lightbox mode. Another option is creating a control and using ContentManager.GetItems(), then bind the items to another control and using js show the images.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    15 Jun 2009
    Link to this post
    Thanks, I suppose that should have been obvious, didn't click that setting the CategoryID property would override the filterexpression.

    As for the AJAX reply, thanks that will be helpful. I think I will place it in the 'would be nice if everything was perfect' pile for now. Not that big of a deal, just a 'nice' thing.

    Thanks for the help, you guys are tops.
Register for webinar
3 posts, 0 answered