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

Forums / Developing with Sitefinity / Developing with Telerik.Events

Developing with Telerik.Events

14 posts, 0 answered
  1. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    25 Apr 2008
    Link to this post

    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:

    • Files for events module
    • Creating an event
    • Deleting an event
    • Adding meta fields to an event
    • Adding the missing RSS Provider
    Read more at : http://www.josephguadagno.net/Articles/1/Technical-Articles/8/TelerikEvents.aspx
  2. dai bevan
    dai bevan avatar
    2 posts
    Registered:
    05 May 2005
    28 Apr 2008
    Link to this post
    thanks alot!

    Awesome job!

    I have a question regarding meta fields for events.

    Is it possible to add a meta field for a thumbnail image in the ControlPanelList.ascx? And how would you approach it?

  3. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    28 Apr 2008
    Link to this post
    First I think you will need something to generate the thumbnail.  The next step would be to add a meta field to the events record, update the Edit and Insert ascx files.  In addition, you could update the ControlPanelList file.
  4. dai bevan
    dai bevan avatar
    2 posts
    Registered:
    05 May 2005
    29 Apr 2008
    Link to this post
    that's the problem. I don't know how to capture that thumbnail information.

    It might be a question for Telerik.

    Thanks again
  5. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    29 Apr 2008
    Link to this post
    What part of an event do you want to capture a thumbnail of?
  6. sam
    sam avatar
    102 posts
    Registered:
    31 Jan 2008
    29 Apr 2008
    Link to this post
    I am wanting to display a list of events using the ControlPanelList.ascx control and display a thumbnail image next to each event.

    Exactly like you can with the news list..
  7. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    29 Apr 2008
    Link to this post
    I do not see what you are talking about.  Can you post a screen shot?
  8. sam
    sam avatar
    102 posts
    Registered:
    31 Jan 2008
    29 Apr 2008
    Link to this post
    When you add a news item you get the option to add a thumbnail image.
    See Dashboard - Modules - News - Add News Item

    cheers
  9. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    29 Apr 2008
    Link to this post
    Hello sam,

    I think you two guys are thinking of a different things. Sam wants a url picker (which we conveniently use for choosing a thumbnail in news module) and Joshep is thinking about how to generate a thumbnail.

    First and foremost, Joshep thank you for your ongoing and very valuable help. Your Events module documentation really made our day on Friday when you posted it.

    Sam, the functionality you are referring to is also implemented in Contacts module (for choosing a photo of a person). Contacts module is a sample module with open source which you can download and examine here:

    http://blogs.sitefinity.com/Ivan/Post/07-10-19/contacts_module_finalized.aspx

    The particular functionality is implemented in the Sample.Contacts.WebControls.Admin.ContactEditor class.

    The module itself is fairly well commented and there is a whole blog post series on my blog about it. If you have any additional questions about this module, please let me know.

    Kind regards,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    30 Apr 2008
    Link to this post
    Hi,

    Nobody use one solution like ControlPanelList, "list" mode for Library in Image&Docs Module with the Thumbnails inside the RadGrid ?. Regards
  11. sam
    sam avatar
    102 posts
    Registered:
    31 Jan 2008
    05 May 2008
    Link to this post
    Sorry to sound dumb, but I am finding to hard to understand.

    Are you able to make a really basic example of user control using the thumbnail picker?

    thanks
  12. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    05 May 2008
    Link to this post
    Hello sam,

    ok, here is a detailed explanation of how this works:

    The thumbnail picker in News module and the one in Contacts module (link posted few posts below this one) are working on the exactly same principle. Under assumption that you have downloaded the Contacts module and installed it on your local Sitefinity installation, I’ll walk you through the steps:

    First, let’s examine the markup for this control. Open the following file ~/Sitefinity/Admin/ControlTemplates/Contacts/ContactEditorTemplate.ascx

    In this file you are going to find following code:

    <li class="selector">  
      <asp:Label ID="lblPhoto" runat="server" Text="Photo" AssociatedControlID="photo">      
      </asp:Label> 
      <asp:TextBox ID="photo" runat="server"></asp:TextBox> 
      <asp:LinkButton ID="photoPicker" runat="server" Text="Select" CssClass="photoPicker" CausesValidation="false">   
      </asp:LinkButton> 
    </li> 
     

    So, as you can see there are three controls that form the User interface of thumbnail picker:

    1.       Label “lblPhoto” (not really important, only instruction to user)

    2.       Textbox “photo” which will receive the url of the file from the dialog

    3.       LinkButton “photoPicker” which will open the dialog for choosing the file (thumbnail)

    Now, that we have examined the controls that form the user interface of thumbnail picker, let’s open the following file in Visual Studio – Sample.Contacts.WebControls.Admin.ContactEditor (if you’ve been following the instructions in the blog post I’ve provided the link for, you should have a solution in the Visual Studio consisting from Website, Sample.Contacts and Sample.Contacts.Data projects.

    ContactEditor control is the control that uses the template with the user interface explained towards the beginning of this post. Expand properties and you will find a string property named “Photo” which gets or sets the value of a “photo” TextBox explained earlier. So, this is the first step – create a property. If you expand the Private fields region, you’ll notice two more fields that we are going to need, namely -         

    private PropertyEditorDialog editorDialog;   
     
    private PropertyDescriptorCollection properties;  
     


    First field is a control that acts as a dialog and we can open it, second field will represent the collection of all properties inside of ContactEditor control (remember how we made the “Photo” property that gets or sets the value of the “photo” textbox).

    Now, go to the CreateChildControls method, where you will find following code (at the end of the method):

    this.properties = TypeDescriptor.GetProperties(this);  
    this.editorDialog = new PropertyEditorDialog();  
     
    this.editorDialog.TypeContainer = this;  
    this.editorDialog.PropertyChanged += new PropertyValueChangedEventHandler(EditorDialog_PropertyChanged);  
    this.Controls.Add(this.editorDialog);  
     
    this.layoutContainer.PhotoPicker.CommandName = "Telerik.FileManager.UrlWebEditor, Telerik.FileManager";  
    this.layoutContainer.PhotoPicker.CommandArgument = "Photo";  
    this.layoutContainer.PhotoPicker.Command += new CommandEventHandler(PhotoPicker_Command);  
     

    So,  first we initialize the properties field to all the properties of the ContactEditor control that we are working with. Then we create a new instance of PropertyEditorDialog and assign it to the editorDialog field. So, we have initialized both of our private fields.

    Now, we need to set up the properties of editorDialog. Because editorDialog needs to know who opened it, we set TypeContainer to “this”. When a property changes in editorDialog, we need to provide an event handler that will do something with this property.

    Then you can see that we are setting the command name of the button (LinkButton from the UI) to that of the UrlWebEditor (which is the dialog that lets you choose the file name), we set the CommandArgument to the name of the Property which gets or sets the value of textbox from our UI and finally we assign an event handler to the LinkButton.

    The last thing we need to do is implement the event handlers we’ve declared in previous step. Here is how this looks like:

    private void PhotoPicker_Command(object sender, CommandEventArgs e)  
    {  
       object data = null;  
       string name = (string)e.CommandArgument;  
       PropertyDescriptor desc = this.properties.Find(name, false);  
     
       data = desc.GetValue(this);  
     
       this.editorDialog.Show(name, e.CommandName, data, this);     
    }  
     
    private void EditorDialog_PropertyChanged(object source, PropertyValueChangedEventArgs e)  
    {  
        this.SetProperty(thisthis.properties, e.PropertyName, e.PropertyValue);  
    }  
     
    private void SetProperty(object component, PropertyDescriptorCollection properties, string name, object value)  
    {  
        PropertyDescriptor desc = this.properties.Find(name, false);  
        desc.SetValue(this, value);  
    }  
     
     

    The first event handler handles command when fired by LinkButton. We find the property (from CommandArgument and you remember we set it to “Photo” property), we get the value of this property (this is because there may already be a url in the textbox, so we want to pass that to dialog so the file structure can be opened correctly and proper file selected). Finally, we call the Show method of editorDialog and pass it the name of the property we want this dialog to edit, we pass it the type of the dialog we’d like it to show (UrlWebEditor), we send it any already existing data for this property, and finally the instance of the object that called the dialog (this).

    In second event handler, dialog has changed the value of the property and it returns the PropertyValueChangedEventArgs which carry the name of the property that was changes as well as the new value of this property.

    Finally, the SetProperty method is a helper method that simply finds the property and sets it to the new value (which is presumably the url of the newly selected thumbnail).

    I hope I've made this whole thing a bit clearer. Let me know if you have any additional questions.

    Best wishes,
    Ivan
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  13. Fauzan Khan
    Fauzan Khan avatar
    1 posts
    Registered:
    06 May 2008
    12 May 2008
    Link to this post

    The events module does not support registrations to the event. If I want to register a user for a particular event can someone guide me how it should be done. I am pretty new to the product.

    What I would like, is to have a button on the event page which would say register.If the user is already registered it would allow cancellation of the registration.

    I will have a table which will track registered users against the event. That way I can send registered users updates on the event.

    Fauzan

  14. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    14 May 2008
    Link to this post
    Hi Fauzan Khan,

    While there are several ways to implement registration for events module, I think you may be better off by creating a new module for registration. You could make it more generic so that it supports registration for other items, not just events.

    Let's say you name that module "Registration" (it could be pluggable or intra-site module - you have examples for both on blogs.sitefinity.com). In your data layer, you'll need only one object (or table for that matter) which would be the look-up table. Namely, you would only need a table that would store id (guid) of IContent object (event can be read as IContent or IEvent) and the username. All the info about Events or whatever else you may want people to register for would be in the Events module, while the information about person registring can be stored in ASP.NET Membership (namely Profile).

    You could also add two additional meta fields to the Events module (it's based on Generic Content, so it's very simple. Here is a video tutorial http://www.sitefinity.com/Videos/UsingCustomMetaFieldsWithContent/): Capacity (how many people can register for the event) and CurrentOccupancy (how many people have registered so far).

    So, every time someone registers from the public side (your "Registration" module would have to provide some public controls such as "Registration form"), you would check if the user with that username has not already registered for the event, then make sure that CurrentOccupancy of the Event is less than Capacity, finally if everything is fine, you would add the username and event id to your lookup table and increased the value of CurrentOccupancy by one.

    I hope this helps. Let me know if we can help you with something else.

    Best wishes,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
14 posts, 0 answered