More in this section

Forums / Developing with Sitefinity / How do I display events for specific culture

How do I display events for specific culture

4 posts, 0 answered
  1. Priya Ramesh
    Priya Ramesh avatar
    26 posts
    Registered:
    23 Jul 2009
    27 Sep 2009
    Link to this post
    Hi ,
       I have 3 different cultures in my website. I am displaying events using my custom control. How do I display events for a specific culture.

    Thanks,
    Priya
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Sep 2009
    Link to this post
    Hello Priya Ramesh,

    Below is a sample code that illustrates desired functionality

     CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture; 
            System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("bg"); 
            ContentManager cm1 = new ContentManager("Events"); 
            IList allEvents = cm1.GetContent(); 
            { 
                foreach (IContent cnt1 in allEvents) 
                { 
                    Response.Write(cnt1.GetMetaData("Title").ToString()); 
                } 
            } 

    I hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Priya Ramesh
    Priya Ramesh avatar
    26 posts
    Registered:
    23 Jul 2009
    28 Sep 2009
    Link to this post
    Hi,
       I am not able to add events for other cultures. I set allowlocalization  for events and news. The news works fine.
    But I am not able to add events for other cultures. It only shows english events. The box which appears for language selection does not appear for events. Do I have to set something else.

    Thanks,
    Priya
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Sep 2009
    Link to this post
    Hi Priya Ramesh,

    1. You need to enable localization from <localization> node.
    2. Enable localization for events provider - allowLocalization="True"
    3. Create an event for the other culture.

    When you switch the language the EventsView control will automatically bind correct items. Since you use a custom control you could consider the code I sent you.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered