More in this section

Forums / General Discussions / Event Category

Event Category

6 posts, 0 answered
  1. Rakesh
    Rakesh avatar
    72 posts
    Registered:
    11 Jan 2011
    12 Oct 2011
    Link to this post
    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...............
  2. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    12 Oct 2011
    Link to this post
    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
  3. Rakesh
    Rakesh avatar
    72 posts
    Registered:
    11 Jan 2011
    13 Oct 2011
    Link to this post
    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 ?
  4. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    13 Oct 2011
    Link to this post
    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
  5. Rakesh
    Rakesh avatar
    72 posts
    Registered:
    11 Jan 2011
    13 Oct 2011
    Link to this post
    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.
  6. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    13 Oct 2011
    Link to this post
    Hi,

    if your thumbnail is a custom field you can get it like this :
    String NameOfCustomField = "thumbnail";
     
    eI.GetValue(NameOfCustomField)



    Regards,
    Nicolas
6 posts, 0 answered