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

Forums / Developing with Sitefinity / How does the ContentViewSingleItemView.ascx work?

How does the ContentViewSingleItemView.ascx work?

2 posts, 0 answered
  1. Randy
    Randy avatar
    19 posts
    Registered:
    13 Nov 2007
    12 May 2009
    Link to this post
    I would like to customize the ContentViewSingleItemView control. 
    I want to be able to use the event_start date in more than one place on the control. 

    It looks like I need a form object with an ID of "Event_Start" With the IDs needing to be unique, this only allows me to display it once. 

    Is there another way to get at the event_start property?  

    Do I need to create a new custom control and use the event API?  If so, do I need to create a custom master control that sends the event id in a querystring too?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 May 2009
    Link to this post
    Hello Randy,

    You need to map the values of meta-fields to any property of any control inside of a template. I am sending you two custom controls that you should add in App_Code folder.

    Then you can use the following declaration in your control template:

    <cc1:MetaMaster ID="MetaMaster2" runat="server"
    <Mappings> 
    <cc1:MetaMapping MetaKey="Events_Start" TargetControlID="Label1" TargetProperty="Text" /> 
    </Mappings> 
    </cc1:MetaMaster> 
     
    <asp:Label ID="Label1" runat="server"></asp:Label> 

    MetaKey – the value of which meta-field should be mapped to control’s property
    TargetControlId – the id of the control whose property you want to map to meta-field value
    TargetProperty – finally, the value of which property you want to set to the value of meta-field

    The way standard ContentView control works is following – it reads all the metakeys, tries to find the controls with same ids and then sets the text property of the control to the value of the meta-field.


    Best wishes,
    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.
2 posts, 0 answered