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

Forums / Developing with Sitefinity / How to create a second ContentViewItemView.ascx

How to create a second ContentViewItemView.ascx

2 posts, 0 answered
  1. thomas3577
    thomas3577 avatar
    22 posts
    Registered:
    18 Feb 2007
    31 Oct 2009
    Link to this post
    I need a second view for Events and News. But i do not want override the exist ContentViewItemView.ascx
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    31 Oct 2009
    Link to this post
    Hi thomas3577,

    NewsView comes with only one presentation mode - List and Page. There are several presentation modes for EventsView control - listPageMode, ExpandableList, allInAListMode.

    To add new view you should do the following.

    1. Map the control designers for NewsView and EventsView controls.
    2.Create a new custom templates for your views.
    3. Add new Presentation mode in the Designer of the control.
    4. Create a TextSettings for the newly created modes.

    Sample code:

    <sfDesign:PresentationModes ID="presentationModes" runat="server">
                        <sfDesign:PresentationMode ID="CustomMode" runat="server"
                                                   ModeTitle=Custom"
                                                   ModeSettingsId="CustomSettings1"
                                                   MasterTemplateName="PATH TO YOUR TEMPLATE"
                                                   DetailTemplateName="PATH TO YOUR TEMPLATE"
                                                   CssClass="YOUR CSS"
                                                   SelectedCssClass="YOUR CSS
                                                   >
                            <Template>
                                    <asp:RadioButton ID="CustomID" runat="server" />
                                    <p>some description about yoru presentation mode.</p>
                                 
                            </Template>
                        </sfDesign:PresentationMode>
     
     
    ....
         .....
     <sfDesign:PresentationModeSettings ID="CustomMode" runat="server">
                        <DetailHeaderTemplate>
                            <div class="selectedModeShortDescription">
                                 <h3>Selected mode</h3>
                                <h4 class="selectedTitlePageList">mode name</h4>
                                <p>some description</p>
                            </div>
                            <sfDesignSettings:PagingSetting id="pagingSetting" AllowListLimitSetting="true" DefaultListLimit="100" AllowPagingSetting="true" DefaultPageCount="10" LimitList="false" runat="server"></sfDesignSettings:PagingSetting>
                             
                            <h4>For the list display</h4>
                            <ul>
                        </DetailHeaderTemplate>
                        <DetailSettings>
                            <sfDesignSettings:TextSetting ID="setting1"
                                                  TargetID="content"
                                                  SettingTitle="Title"
                                                  AllowLabelSetting="False"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="False"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
       ....
                           </sfDesignSettings:TextSetting>                               
                           
                        </DetailSettings>
                        <DetailFooterTemplate>
                            </ul>
                        </DetailFooterTemplate>
                        <MasterHeaderTemplate>
                            <h4>For every item display:</h4>
                            <ul>
                        </MasterHeaderTemplate>
                        <MasterSettings>
                            <sfDesignSettings:TextSetting ID="TextSetting6"
                                                  TargetID="content"
                                                  SettingTitle="Title, linking to the post page"
                                                  AllowLabelSetting="False"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="False"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                           
                   ...
                          ....
          </sfDesignSettings:TextSetting>                  
                        </MasterSettings>
                        <MasterFooterTemplate>
                            </ul>
                            <sfDesignSettings:BehaviorSetting id="behaviorSetting" runat="server"></sfDesignSettings:BehaviorSetting>
                        </MasterFooterTemplate>
                    </sfDesign:PresentationModeSettings>


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered