Event Category

Posted by Community Admin on 03-Aug-2018 12:41

Event Category

All Replies

Posted by Community Admin on 12-Oct-2011 00:00

Hi,

I have created events and added category also..

Is their any way to list these categories in a drop down ?
(only event categories with their guid)

please help me....its very very urgent..

please...............

Posted by Community Admin on 12-Oct-2011 00:00

Hi,

protected IQueryable<Event> eventsList;
protected List<Guid> classifList = new List<Guid>();
 
 
private void GetThemeList(IQueryable<Event> eventsList)
    foreach (Event eI in eventsList)
        AddToClassifList(eI.GetValue<TrackedList<Guid>>(catTheme));
 
private void AddToClassifList(TrackedList<Guid> listId)
    if (listId != null)
        foreach (Guid taxaId in listId)
        
            if (taxaId != Guid.Empty && !classifList.Contains<Guid>(taxaId))
                classifList.Add(taxaId);
        

"catTheme"
is your own hierarchical category.

Regards,
Nicolas

Posted by Community Admin on 13-Oct-2011 00:00

Hi Nicolas,
I did not understand what you said.I am new to Sitefinity.
What do you mean by
"catTheme"
 is your own hierarchical category."


My requirement is..,

I created an event "Event 1" and created a category "Category 1" for this event.
Now I want to load this "Category 1" to a drop down list to filter events.

how can I do this?can you please help me ?

Posted by Community Admin on 13-Oct-2011 00:00

Hi,

you create "Category 1" into Categories on backend ? Or Have you created a Hierarchical Classification on your own and put it into ?

If you use standard Categories :

private void GetThemeList(IQueryable<Event> eventsList)
    foreach (Event eI in eventsList)
        AddToClassifList(eI.GetValue<TrackedList<Guid>>("Categories"));

In my example, you have to fill "eventsList" by your created events. And Call method GetThemeList, the "classifList" will be filled by classifications GUID used on your events.

If you want it in a comboBox it'll be more easier to transform "List<Guid> classifList" into "Dictionary<Guid, String>". You have to modify like this :
private void AddToClassifList(TrackedList<Guid> listId)
    if (listId != null)
        foreach (Guid taxaId in listId)
        
            if (taxaId != Guid.Empty && !classifList.Contains<Guid>(taxaId))
                classifList.Add(taxaId, TaxonomyManager.GetManager().GetTaxon(taxaId).Title);
        


Now on your created events you can find category :
Event event1 ....
 
//return true if a specific category item exist on an event
event1 .Organizer.TaxonExists("Categories", GuidOfCategory1)



Regards,
Nicolas

Posted by Community Admin on 13-Oct-2011 00:00

Hi Nicolas,

Thanks for your help.You solved my issue.....thanks a lot...

One more doubt..
I have added thumbnail for Event.Is their any way to get the thumb nail image from the code behind if I have the EventId ?

Thanks and Regards
Rakesh.

Posted by Community Admin on 13-Oct-2011 00:00

Hi,

if your thumbnail is a custom field you can get it like this :

String NameOfCustomField = "thumbnail";
 
eI.GetValue(NameOfCustomField)



Regards,
Nicolas

This thread is closed