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

Forums / Developing with Sitefinity / Category Picklist for control properties?

Category Picklist for control properties?

5 posts, 0 answered
  1. Cory Isakson
    Cory Isakson avatar
    5 posts
    Registered:
    08 Aug 2003
    20 Apr 2008
    Link to this post
    Is there a way to get a picklist of categories in the property pane of the modules that display categorized content?  For example, I want to show only the events from a specific category on a page in my site.  Currently I have to know the GUID of the CategoryID.  The only way I could even find this GUID was to query the database.  Is it possible to have a picklist that shows the Category names instead?
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    21 Apr 2008
    Link to this post
    Hi Cory Isakson,

    I can understand your frustration with the GUID for category property in EventsView. The good news is that we have already completed the designer for EventsView control, which features category selection, time filter (upcoming events, past events, all events), three different modes of displaying events (PageList, ExpandableList and ExpandedList) and many other things. This will be part of our next release (Sitefinity 3.2 SP2).

    On the other hand, let me answer your question of whether is there a way to do this: Yes, there is a way. Obviously, you would need to create your own control first (you could inherit EventsView control). Then you would need to create a property for selecting categories that you wish to display, let's say you name it "SelectedCategories" and it is an array of GUID's, so that more than one category can be selected. In order to get a picker, you would need to implement that property as a complex property ("complex" is just something I use, it's not really an official term :)). The tutorial with sample project you can find here:

    http://blogs.sitefinity.com/Ivan/Post/07-05-24/working_with_complex_properties_in_custom_public_controls_webtypeeditor_.aspx

    Finally, you would need to override the IMetaSearchInfo[] CreateFilter() function and add a filter for the selected categories from your property. EventsView is inheriting from ContentView control, so for better control and more flexibility perhaps you would be better off inheriting from ContentView control.

    I hope this was helpful. Let me know if you have any additional questions.

    Greetings,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Damian
    Damian avatar
    42 posts
    Registered:
    25 Mar 2008
    22 Apr 2008
    Link to this post
    Cory / Ivan,

    please could one of you describe to me the process of getting the GUID for event categories and setting the filter on the EventsView Control, as Cory described he can do in his original post.

    Thanks

    Damian
  4. Cory Isakson
    Cory Isakson avatar
    5 posts
    Registered:
    08 Aug 2003
    22 Apr 2008
    Link to this post
    Damien,

    I found the category Guids by opening the sf_CmsCategory table in the database.  Find the row for the category you want to filter by.  The ID column contains the Guid that you need to enter in the EventsView for the CategoryID property.  Also, set the display mode to Category and that is it.  You will then only see the events for the selected category. 
  5. Damian
    Damian avatar
    42 posts
    Registered:
    25 Mar 2008
    23 Apr 2008
    Link to this post
    Thanks Cory,

    Worked a treat.

    Damian
Register for webinar
5 posts, 0 answered