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

Events Module

10 posts, 0 answered
  1. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    18 Feb 2009
    Link to this post
    Hi

    I am trying to display the events using the Events view. This displays the location with labels Street: City: etc.

    I want to format this to only display the city and country - like

    Chicago, IL.

    How can I do this ?

    Thanks.

    Kalpana
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Feb 2009
    Link to this post
    Hi Kalpana,

    The easiest way to hide them is by removing the text before every control in the placeholder. You should edit the following templates:

    ~/Sitefinity/ControlTemplates/Events/Modes/ListPageMaster.ascx

     <address id="Location" runat="server" class="sf_eventLocation"
                    Street: <asp:Literal ID="Street" runat="server" Text="{0}"></asp:Literal><br /> 
                    City: <asp:Literal ID="City" runat="server" Text="{0}"></asp:Literal><br /> 
                    Country: <asp:Literal ID="Country" runat="server" Text="{0}"></asp:Literal><br /> 
                    State: <asp:Literal ID="State" runat="server" Text="{0}"></asp:Literal><br /> 
    </address> 

    You can do the same for ~/Sitefinity/ControlTemplates/Events/Modes/ListPageDetail.ascx

    <asp:PlaceHolder id="plhWhere" runat="server"
            <address id="Location" runat="server" class="sf_eventLocation"
                Street: <asp:Literal ID="Street" runat="server" Text="{0}"></asp:Literal><br /> 
                City: <asp:Literal ID="City" runat="server" Text="{0}"></asp:Literal><br /> 
                State: <asp:Literal ID="State" runat="server" Text="{0}"></asp:Literal><br /> 
                Country: <asp:Literal ID="Country" runat="server" Text="{0}"></asp:Literal><br /> 
            </address> 
       </asp:PlaceHolder> 

    I hope this helps

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    19 Feb 2009
    Link to this post
    Hi Ivan

    That worked. Thanks. I had to change Sitefinity\ControlTemplates\Events\Mode\AllPostsListMaster.ascx.

    I have a related question. I added two other attributes to the events module and made changes to the admin pages. That worked. My question is how do I access these to display in the Event view. I have a priority attribute which I want to use for filtering the events. I also have a link URL (LinkPage) that I want to go to when clicking on the Title.

    Thanks.

    Kalpana
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Feb 2009
    Link to this post
    Hi Kalpana,

    You should change EventsViewControlDesigner located under ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx. You should add/modify TextSetting control  and its properties. Thus your attributes will appear in the designer and you will be able to control them.
    Another way( depends on the attributes you have) is adding  the attributes to the ListPageMaster and ListPageDetails or other template you want to modify.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    20 Feb 2009
    Link to this post
    Hi Ivan

    I had to add a hyperlink to the title. So I followed the instruction on

    http://www.sitefinitywatch.com/blog/09-01-15/Adding_Custom_Fields_to_Existing_Sitefinity_Modules.aspx

    I copied the MetaMaster2008 files to AppCode. Made changes to Sitefinity\ControlTemplates\Events\Mode\AllPOSTSListMaster.ascx.

    <%@ Register Assembly="App_Code" Namespace="MetaMaster2008" TagPrefix="my" %>

    <my:MetaMaster ID="MetaMaster1" runat="server">   
        <Mappings>  
            <my:MetaMapping MetaKey="LinkPath" TargetControlId="LinkPath_HyperLink" TargetProperty="NavigateUrl" />  
        </Mappings>  

    </my:MetaMaster>

                <b><asp:HyperLink ID="LinkPath_HyperLink" runat="server" Target="_blank" >
                       <asp:Literal ID="Title" runat="server"></asp:Literal>

                </asp:HyperLink></b><br />

    I get this runtime error:

    Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 89:             {
    Line 90:                 IContent cnt = cntManager.GetContent(contentView.SelectedItemId);
    Line 91:                 string metaValue = cnt.GetMetaData(this.MetaKey).ToString();
    Line 92: 
    Line 93:                 // find the target control

    Source File: c:\Program Files (x86)\telerik\Sitefinity3.5 Community\WebSites\D2L\App_Code\MetaMaster\MetaMapping.cs    Line: 91



    I would appreciate your help.

    Thanks.

    Kalpana
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Feb 2009
    Link to this post
    Hi Kalpana,

    Open MetaMappings.cs, find line 91 where GetMetaData method is used and do the changes below:
    IContent cnt = cntManager.GetContent(contentView.SelectedItemId); 
    string metaValue = string.Empty; 
    object objVal = cnt.GetMetaData(this.MetaKey); 
    if (objVal != null) metaValue = objVal.ToString(); 

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    26 Feb 2009
    Link to this post
    Ivan

    I still get the error but on a different line
    object objVal = cnt.GetMetaData(this.MetaKey); 

    Thanks.

    Kalpana

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    26 Feb 2009
    Link to this post
    Hi Kalpana,

    I am not able to reproduce this locally. Everything works fine at my end with the provided solution. Could you send me the code snippets of your implementation?

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    04 Mar 2009
    Link to this post
    1) I added the two files in the app-code directory.
    2) I changed the code as per your instruction.
    3) I added this to Sitefinity\ControlTemplates\Events\Mode\AllPOSTSListMaster.ascx
    <%@ Register Assembly="App_Code" Namespace="MetaMaster2008" TagPrefix="my" %>

    <my:MetaMaster ID="MetaMaster1" runat="server">   
        <Mappings>  
            <my:MetaMapping MetaKey="LinkPath" TargetControlId="LinkPath_HyperLink" TargetProperty="NavigateUrl" />  
        </Mappings>  

    </my:MetaMaster>

                <b><asp:HyperLink ID="LinkPath_HyperLink" runat="server" Target="_blank" >
                       <asp:Literal ID="Title" runat="server"></asp:Literal>

                </asp:HyperLink></b><br />

    When I open the page with the events control I get the error.

    Should I be doing anything else?

    Thanks

    Kalpana
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    05 Mar 2009
    Link to this post
    Hi Kalpana,

    Try using the code below and the files I am sending you. You can alter the namespace in  MetaMaster and MetaMapping classes if you want.

    <%@ Register Assembly="App_Code" Namespace="RandomSFCode.MetaMaster2008" TagPrefix="cc1" %> 
         
    <cc1:MetaMaster ID="MetaMaster1" runat="server">    
        <Mappings>   
            <cc1:MetaMapping MetaKey="LinkPath" TargetControlId="LinkPath_HyperLink" TargetProperty="NavigateUrl" /> 
        </Mappings>   
    </cc1:MetaMaster> 
        <b><asp:HyperLink ID="LinkPath_HyperLink" runat="server" Target="_blank" > 
                       <asp:Literal ID="Literal3" runat="server"></asp:Literal> 
            </asp:HyperLink></b><br /> 
         


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
10 posts, 0 answered