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

Forums / Developing with Sitefinity / Event not display

Event not display

5 posts, 1 answered
  1. Varinder Kumar
    Varinder Kumar avatar
    15 posts
    Registered:
    13 Apr 2010
    11 Aug 2010
    Link to this post
    Hello All,

    I am creating a user module, which dynamically creates an event on button click.  It works fine, means on button click, I can create a event, which I can also see in sitefinity environment via admin login, the issue is I can't see that created event in my page.  

    I can see only that events which I created in sitefinity environment via admin login.

    So can anyone please suggest me how I can see my events (programmatically created).

    I am using the following code for creating event:

    public void CreateEvent(
        string eventTitle,
        string eventDescription,
        string contactName,
        string contactEmail,
        string contactPhone,
        string contactCell,
        string contactWeb,
        string street,
        string city,
        string state,
        string country,
        DateTime eventStartDate,
        DateTime eventEndDate,
        DateTime eventExpirationDate,
        DateTime publicationDate,
        string geomappingData,
        string categoryName)
        {

            string providerName = "Events";
            EventsManager eventsManager = new Telerik.Events.EventsManager(providerName);
            IContent newEvent = eventsManager.Content.CreateContent("text/html");

            // Set the Generic Content Meta Data
            newEvent.SetMetaData("Title", eventTitle);
            newEvent.SetMetaData("Content", eventDescription);
            newEvent.SetMetaData("Street", street);
            newEvent.SetMetaData("City", city);
            newEvent.SetMetaData("State", state);
            newEvent.SetMetaData("Country", country);
            newEvent.SetMetaData("Contact_Name", contactName);
            newEvent.SetMetaData("Contact_Email", contactEmail);
            newEvent.SetMetaData("Contact_Phone", contactPhone);
            newEvent.SetMetaData("Contact_Cell", contactCell);
            newEvent.SetMetaData("Contact_Web", contactWeb);

            newEvent.SetMetaData("Event_Start", eventStartDate);
            newEvent.SetMetaData("Event_End", eventEndDate);
            newEvent.SetMetaData("Publication_Date", publicationDate);
            newEvent.SetMetaData("Expiration_Date", eventExpirationDate);
            //newEvent.SetMetaData("Geomapping_Data", geomappingData);

            // If the categoryName is not null or empty, update the category field.
            if (string.IsNullOrEmpty(categoryName) == false)
            {
                // See if this event category exists
                ICategory category = eventsManager.Content.GetCategory(categoryName);
                if (category == null)
                {
                    // Create the category
                    category = eventsManager.Content.CreateCategory(categoryName);
                    eventsManager.Content.SaveCategory(category);
                }
                // Update the meta data
                newEvent.SetMetaData("Category", categoryName);
            }

            // Save the Generic content
            eventsManager.Content.SaveContent(newEvent);

    Thanks,
    Varinder Kumar
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    11 Aug 2010
    Link to this post
    Hello Varinder Kumar,

    1. Check whether you have applied some filtering on the public control

    2. Make sure that the item has been published. If you use workflow you also have to publish the item, otherwise it is locked in one of the workflow stages.

    3. Try calling SaveConent(item, ContentStatus.Published)

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Varinder Kumar
    Varinder Kumar avatar
    15 posts
    Registered:
    13 Apr 2010
    11 Aug 2010
    Link to this post
    Hello Ivan Dimitrov,

    Thanks for reply.

    As you suggested I did all the things, but still no luck, means same thing is happening as earlier.



    Thanks,
    Varinder Kumar
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    11 Aug 2010
    Link to this post
    Hi Varinder Kumar,

    I set up the code as is and run it. I am not able to reproduce this issue locally as you will see in the attached video.
    Check whether there is not some page caching, remove/add EventsView control.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  5. Varinder Kumar
    Varinder Kumar avatar
    15 posts
    Registered:
    13 Apr 2010
    14 Aug 2010
    Link to this post
    Hello Ivan Dimitrov,

    Thanks for your valuable reply with sending me attachment.

    With your help I resolved the issue and now the events are displaying properly.


    Thanks,
    Varinder Kumar
Register for webinar
5 posts, 1 answered