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

Forums / Suggestions / Please add Telerik.Events.* to API Reference

Please add Telerik.Events.* to API Reference

7 posts, 0 answered
  1. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    22 Apr 2008
    Link to this post
    i know it's a new module and all but it took me forever to figure out the error that the property is called "EventTitle" and not "Title". I tried to look in the developers manual and it wasn't there. eventually I remembered the object browser in Visual Studio, but it would be nice to be able to just look it up. thanks!
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    24 Apr 2008
    Link to this post
    Hello SelArom,

    I am sorry that we caused you so much frustration. Just to let you know that we are already working on the Events module documentation (as well as improving all the other developers documentation) and the first results you should see with the release of the new service pack.

    Once again, as a developer I can feel your pain when the docs are missing. We are making a lot of efforts at the moment to drastically improve this part of Sitefinity.

    Sincerely yours,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    25 Apr 2008
    Link to this post
    How is this for a starter...

    Telerik.Events

    The Telerik.Events assembly is distributed with Sitefinity. This module is responsible for adding, removing, deleting events from the Sitefinity system. This guide is meant to supplement the documentation that is available for Sitefinity. This document will cover the following: As of the time when this was written, development documentation does not exist for the Telerik.Events assembly. The code samples where either "figured out" or derived from other samples. Thanks to Visual Studio®'s Intellisense® feature, Visual Studio®'s Object Browser and Reflector, I figured out most of it.
    In order to work with events in Sitefinity you must add a reference to the Telerik.Events assembly. This assembly is already included in the Sitefinity install; it is mentioned in case you want to create a separate assembly for your events customization. The Telerik.Events.EventsManager handles all of the event management. An instance of the EventManager can be created like this.
    string providerName = "Events";
    EventsManager eventsManager = new Telerik.Events.EventsManager(providerName);
    After this, the eventsManager object will contain all the methods that you should need.

    Files for events module

    Like most (if not all) modules, the templates or user controls are keep in two directories underneath the /Sitefinity folder, the Sitefinity\Admin\ControlTemplates\<ModuleName>, in this case Events and Sitefinity\ControlTemplates\<ModuleName>. Within these directories you will find a collection of files and one folder App_Resources. The App_Resources folder provides Sitefinity (or any .NET application) the ability to be localized. Keep in mind that if you want to change the text of a field or add a new field you will probably find the string in the corresponding .resx. In other words, if you are modifying CommandPanel.ascx you will find the resources to modify in \App_Resources\CommandPanel.ascx.resx. An example of this can be found in the section Adding meta field to an event.
    The developers of Sitefinity seem to be consistent with the naming of files, they sort of follow this syntax <object><function>.ascx. So the insert form for an event can be found in the ControlPanelInsert.ascx file.

    Admin\ControlTemplates\Events Files

    This folder contains the files for the administrative portion of the events modules. While in most cases, except for adding meta fields to the event, you will not need to modify these files. However, if you are like me you like to know how things work.
    Filename Purpose
    CategoriesField.ascx  Contains a list of event categories.
    CategoriesManagement.ascx  Provides functions to manage the categories; add, rename, etc.
    CategoriesSelector.ascx  
    CommandPanel.ascx  The command panel contains all of the functions for managing the events modules. This is the list that appears on the left hand side. Command panels load the Control Panels (middle of the interface).
    CommentsEdit.ascx  This control provides the ability to edit comments for an event.
    CommentsList.ascx  This control lists the comments for an event.
    CommentsView.ascx  This control lists a single comment for an event.
    ContentSelector.ascx  
    ContentVersionView.aspx  This control is used when viewing the version history of an event (or any generic content item)
    ControlPanelEdit.ascx  This control is used when editing an existing event.
    ControlPanelInsert.ascx  This control is used when adding a new event.
    ControlPanelList.ascx  This control is used to list all of the events.
    ControlPanelPermissions.ascx  This control is used to display / modify the permissions for events. This can be viewed by clicking on "Permissions" in the command panel.
    EditorTemplate.ascx  This control is used to display the RadEditor for the content of the event. This is used for all generic content.
    EventsScheduler.ascx  This is the control used when you first enter the events admin module or click on the "Events" link in the command panel.
    GeomappingEditor.ascx  This control is used to edit the geomappings for an event. This is used in ControlPanelInsert and ControlPanelEdit
    GeomappingSettings.ascx  This control is used to update the mapping api URLs and keys. This can be view by clicking on "Geomapping" settings in the command panel.
    NewContentDialog.ascx  I do not think this is used. This is carried over from the Generic Content controls, to create shared content.
    RecurringIntervalSelector.ascx  This is probably for a future release of the events module which would allow you to select a recurrence pattern.
    SelectContentDialog.ascx  I do not think this is used. This is carried over from the Generic Content controls, to share content.
    TagEditor.ascx  This is used when editing a tag on an event.
    TagsManagement.ascx  This control is used to manage the tags for the events. This can be viewed by clicking on the "Tags" link in the command panel.

    ControlTemplates\Events Files

    This folder contains the files for the public/display portion of the events modules. These controls will be used to display the events on the public facing site.
    Filename Purpose
    ArchiveTemplate.ascx  
    CategoriesList.ascx  Displays a list of event categories and the number of events in that category. Not displayed in the "Community" template.
    CommentsList.ascx  Displays the list of comments for an event.
    CommunityContentViewItemList.ascx  This control is used by the Events page in the "Community" template to display a list of events.
    CommunityContentViewSingleItem.ascx This control is used to display and event that is clicked in the CommunityContentViewItemList control.
    ContentViewItemList.ascx  This control is used by the Upcoming Events page in the "Community" template to display a list of events.
    ContentViewSingleItem.ascx  This control is used to display and event that is clicked in the ContentViewItemList control.
    eventsCommonLayout.css  The Cascading Style Sheet (CSS) used for the event pages.
    EventsScheduleView.ascx  Displays the events in a calendar view.
    HomeContentViewItemList.ascx  This control is used to display the events in on the home page for the "Community" template.
    TagsList.ascx  Displays the lists of tags for an event.

    Creating an event

    In order to create an event in Sitefinity using the Telerik.Events assembly, you must follow a few steps.
    • Create an instance of the EventsManager class with the correct provider...
      EventsManager eventsManager = new Telerik.Events.EventsManager(providerName);
    • Create a new generic content object...
      IContent newEvent = eventsManager.Content.CreateContent("text/html");
    • Update the meta data...
      newEvent.SetMetaData("Title", eventTitle);
      newEvent.SetMetaData("Content", eventDescription);
    • Optionally, get/create an event category, then update the meta data...
      // 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 content...
      eventsManager.Content.SaveContent(newEvent);

    Utility method for creating an event.

        protected 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);

    }

    Deleting an event

    In order to delete an event using the Telerik.Events assembly, you must get an instance of the Telerik.Events.EventsManager object. As you will see the code sample below, the eventsManager class has one method called DeleteEvent() which has 2 overloads.
    The first overload requires two parameters, the Event GUID which is the Event.Id and a boolen which indicates if the manager should delete the associated generic content.
    public void DeleteEvent(Guid ID, bool deleteContentItem)
    The second overload requires two parameters, the Event which is the Event.Id and a boolen which indicates if the manager should delete the associated generic content.
    public void DeleteEvent(IEvent _event, bool deleteContentItem);
    Warning: This sample will delete all of the events in Sitefinity.
    string providerName = "Events";
    EventsManager eventsManager = new Telerik.Events.EventsManager(providerName);

    IList events = eventsManager.GetEvents();
    foreach (IEvent eventItem in events)
    {
    eventsManager.DeleteEvent(eventItem.ID, true);
    }

    Adding meta fields to an event

    Adding meta fields to the events module is a 5 step process which involves editing the web.config file, editing the administration control templates, and the public display templates.
    For this example we will add a Short Text meta field call ClickToAttendId that we want to be displayed as part of a HTML hyperlink similar to this http://www.clicktoattend.com/invitation.aspx?code=ClickToAttendId

    Step 1: Edit the web.config file.

    Open the web.config file and search for <metaFields>. This is where Sitefinity loads the list of meta tags for each of the generic content modules. You should find a series of "add" XML elements. These "add" elements take 6 attributes, key, valueType, searchable, sortable, and defaultValue.
    Element Purpose
    key The key is made up of two parts, modulename.fieldName. So Events.Title means the Title meta field of the events module.
    valueType   The type of data that will be stored. The following are valid types:
    • Binary
    • Boolean
    • DateTime
    • FloatingPoint
    • Guid
    • Integer
    • LongText
    • ShortText
    visible Indicates whether it will be shown in the admin section of the events module.
    searchable Indicates if you can search on this field.
    sortable Indicates if this field can be sorted on.
    defaultValue The default value for this field.
    Add a XML element to the <metaFields> section that looks like this
    <add key="Events.ClickToAttendId" valueType="ShortText" visible="True" searchable="False" sortable="True" defaultValue=""/>
    Save an close the web.config.

    Step 2: Edit the Admin\ControlTemplates\Events\ControlPanelEdit.ascx.

    Where you place the HTML markup depends on where you think the control needs to be. At the minimum it needs to be placed after the <p class="button_area top"> code block and before the block...
        </ItemTemplate>
    </sfGCn:ContentMetaFields>
    An example of the markup could look like this.
        
    <h3><asp:Literal ID="ltrClickToAttend" runat="server" Text="<%$Resources:ClickToAttend %>"></asp:Literal></h3>
    <fieldset class="set">
    <div class="setIn">
    <asp:Label ID="lblClickToAttendId" runat="server" Text='<%$Resources:ClickToAttendId %>' AssociatedControlID="ClickToAttendId"></asp:Label>
    <asp:TextBox ID="ClickToAttendId" runat="server"></asp:TextBox>
    </div>
    </fieldset>
    <div class="bottom">
    <div>
    <!-- -->
    </div>
    </div>
    The <h3>< section is used for the title of grouping of the data.
    The <fieldset class="set"> element is used to contain the label and text box for the ClickToAttendId.
    Notice that there is a consistent naming theme for the HTML controls, lblfieldName for the label (this is optional), the text box must be the fieldName or Sitefinity will not be able to update it.
    Save the file.
    Open up App_Resources\ControlPanelEdit.ascx.resx and add in any of the resources that you referred to in this sample, namely ClickToAttendId.

    Step 3: Edit the Admin\ControlTemplates\Events\ControlPanelInsert.ascx.

    The ControlPanelInsert.ascx should be edited in the same way that the ControlPanelEdit.ascx was edited.

    Step 4: Edit the ControlTemplates\Events\CommunityContentViewSingleItem.ascx

    The markup can be placed anywhere inside the div block <div class="sf_eventContent">.
    A sample of the markup could be.
        <h4>Event Registration</h4>
    <p>This event requires registration, please register <a href='http://www.clicktoattend.com/invitation.aspx?code=<asp:Literal ID="ClickToAttendId" runat="server"></asp:Literal>'>here</a>.</p>
    Just as in the administrative templates, in order to display the meta data there should be a control on the form that matches the name of the meta data.
    Save the file.
    If neccessary, open up the App_Resources\ContentViewSingleItem.ascx.resx file and add whatever resources you require.

    Step 5: Edit the ControlTemplates\Events\ContentViewSingleItem.ascx

    For some reason, the markup of the ContentViewSingleItem is a bit different.
    The markup can be placed anywhere inside the div block <div class="sf_eventContent">.
    A sample of the markup could be.
    <asp:PlaceHolder ID="plClickToAttendId" runat="server">
    <h2>Event Registration</h2>
    <p>Please click
    <asp:HyperLink ID="ClickToAttendId" runat="server" NavigateUrl='<% "http://www.clicktoattend.com/invitation.aspx?code=" + this.Text %>'></asp:HyperLink>
    to complete the registration for this event.</p>
    </asp:PlaceHolder>
    Save the file.
    If neccessary, open up the App_Resources\ContentViewSingleItem.ascx.resx file and add whatever resources you require.

    Adding the missing RSS Provider

    Coming soon...

  4. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    25 Apr 2008
    Link to this post
    The article formatting got a little messed up with the forum.  Please view the post at the following URL http://www.josephguadagno.net/Articles/1/Technical-Articles/8/TelerikEvents.aspx.

    Joseph Guadagno
    Joseph Guadagno's Site
    Southeast Valley .NET User Group
  5. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    25 Apr 2008
    Link to this post

    Thank you very much for helping out, Joseph. We really appreciate your commitment to the Sitefinity community. Your Telerik account has been updated.

    All the best,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Prax
    Prax avatar
    1 posts
    Registered:
    14 Jul 2010
    15 Jul 2010
    Link to this post
    Hi,
    Can you please help me with what I should write in the ControlsConfig.xml file if I have to update the ControlPanelEdit.acsx file in my events module(~/Sitefinity/Admin/ControlTemplates/Events/ControlPanelEdit.ascx)

    I have tried the following   

     

    <viewSettings hostType="Telerik.Events.WebControls.Admin.ControlPanel">

    <additionalTemplates>

    <add key="EditTemplatePath" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Events/ControlPanelEdit.ascx" />

    </additionalTemplates>

    </viewSettings>

     

    but I am getting the following error

    The ViewMode "ContentItemEdit`1" is not defined for this control.


    I was trying the example in the following blog post
    http://www.sitefinitywatch.com/blog/09-01-15/Adding_Custom_Fields_to_Existing_Sitefinity_Modules.aspx

    Prax
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Jul 2010
    Link to this post
    Hello Prax,

    The control you need to edit and define is the following one:

    <!--Edits an event item-->
       <viewSettings hostType="Telerik.Events.WebControls.Admin.EventsItemEdit" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Events/EventsItemEdit.ascx" />

    Regards,
    Georgi
    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
Register for webinar
7 posts, 0 answered