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

Forums / Developing with Sitefinity / Setting and saving custom properties on NewsView derived control from designer

Setting and saving custom properties on NewsView derived control from designer

13 posts, 1 answered
  1. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    04 Jan 2011
    Link to this post
    There are a few moving parts here, so please bear with me...

    Platform: Sitefinity 3.7 SP4, .NET 3.5

    Background
    I have a module derived from News called "Issues", including the "~/App_Code/IssuesView.cs" and "~App_Code/IssuesModule.cs" classes.  The IssuesModule.cs class implements a string property that is public and exposed to the property pages when displayed in the Advanced tab of the control's "Edit" dialog (from the Pages section of the site). I then mapped the control designer to "~/Sitefinity/Admin/ControlTemplate/Issues/IssuesViewControlDesigner.ascx".  This control designer contains a custom ASP.NET User Control that replaces the CategorySelector in "Wizard panel 1".  From within that user control, when a value changes, in server side code it walks up the .Parent chain until it finds a control of type NewViewDesigner.  It then grabs the .DesignedControl from it and casts it to my IssuesView class (there may be a better way to do this, but this is the way I worked out and it seems to work fine). When it has a reference to the IssuesView object, it sets the custom property that I noted earlier with a value based on user input in the designer.

    Problem
    The problem is that this property setting does not seem to get persisted.  More precisely, it gets saved somewhere in the view control's information, but then when I click on the "Advanced" tab, the "set" method of the property is called three times before the properties page displays.  The first time it has the original value, the second time it has the updated value that I want, but then a third time it has the original value again. (Note: I have call stacks for all three of the calls if it would help).

    So, is there some method I need to call when setting a property on the IssuesView object so that the control will accept the new value as the value for that property, or is there some other way to make this happen?

    Thanks,
    Dave Parker
    Coherent Interactive
    Seattle, WA
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Jan 2011
    Link to this post
    Hello Dave,

    What is the type of the property you use? Generally one of the reasons for not persisted values is when you use complex types.In order for Sitefinity to be able to save the property automatically the value of your property needs to be in the string format. Sitefinity will automatically convert primitive types for you, such as integer or boolean, but what if you need to persist property that is an array or a list. If the property is complex you need a TypeConverter will provide logic for converting the complex type to string, and vice versa. Basically, the idea is to serialize the object.

    Regards,
    Ivan Dimitrov
    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
  3. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    04 Jan 2011
    Link to this post
    It is a string property.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    05 Jan 2011
    Link to this post
    Hello Dave,

    Could you share some code to see how you save the data. If you override OnSaving(), create a public string property and set its value there do you have the same issue?

    Greetings,
    Ivan Dimitrov
    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
  5. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    05 Jan 2011
    Link to this post
    In order to provide code it would help for me to provide more details.  I was hoping this would be simple enough that I could avoid that for both of our sakes, but I guess not.

    Goal
    The goal is to change the CategorySelector into a TagsSelector.  We have a need to support multiple categorizations per item and to also filter a View control on multiple categorizations.  Since the built-in Category system only allows one Category per ContentItem, we decided to use Tags to fulfill our needs (Note: I realize that Sitefinity does not support filtering on multiple Tags, but I have already worked out a solution to that). The next piece, and the one where I am having problems, is to provide a UI that allows a CMS user to select the tags to filter by, just like the CategorySelector on the default NewsViewControlDesigner.

    Another piece of information which may or may not be relevant is that we have several modules derived from News, so I created a ModuleViewBase.cs class in App_Code which derives from Telerik.News.WebControls.NewsView, and all of the modules derive from that.  This allows us to implement shared functionality across them, including the ability to both assign multiple Tags to a ContentItem and to filter items by multiple Tags. It also makes it easier to find the View controls for our custom modules when working with the Sitefinity/ASP.NET apis which only deal with Control or other more generic types.

    Implementation So Far
    What I did was:

    - In ModuleViewBase, I created a FilterTags property of type String.
    private string filterTags;
    [Category("Filters")]
    [Description("Gets or sets the tags to filter this control by when in list view. Enter tags, separated by commas.")]
    [DisplayName("Tags")]
    public string FilterTags
    {
        get { return this.filterTags; }
        set { this.filterTags = value; }
    }

    I then copied the NewsViewControlDesigner.ascx and accompanying .resx to their respective locations in the ~/Sitefinity/Admin/ControlTemplates/Issues folder.

    Next, I created a new UserControl, called TagsSelector, which implements similar functionality to the CategorySelector.  The complete markup for it is here:
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="TagsSelector.ascx.cs" Inherits="UserControls_Coherent_Custom_Controls_TagsSelector" %>
    <asp:UpdatePanel ID="tagsSelectorUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" RenderMode="Block">
        <ContentTemplate>
            <asp:Panel ID="tagsSelectorRadios" runat="server" Style="margin-bottom: 10px;">
                <asp:RadioButton ID="selectAllItems" runat="server" Checked="true" Text="Display all items" GroupName="tagFilterChoice" />
                <br />
                <asp:RadioButton ID="selectSpecificItems" runat="server" Text="Display only items with specific tags" GroupName="tagFilterChoice" />
            </asp:Panel>
            <asp:CheckBoxList ID="tagsSelector" runat="server" AutoPostBack="true" Height="200" Width="250" BorderColor="Black" BorderStyle="Solid"
                BorderWidth="1" BackColor="White" OnSelectedIndexChanged="tagsSelector_SelectedIndexChanged">
            </asp:CheckBoxList>
        </ContentTemplate>
    </asp:UpdatePanel>

    And the code-behind file, TagsSelector.ascx.cs, is:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    using Telerik;
    using Telerik.Cms.Engine;
    using Telerik.News.WebControls.Design;
     
    public partial class UserControls_Coherent_Custom_Controls_TagsSelector : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.ModuleName))
            {
                throw new InvalidOperationException("ModuleName property must be set on TagsSelector control.");
            }
            if (!this.IsPostBack)
            {
                this.InitializeList();
            }
        }
     
        public string ModuleName
        {
            get { return Convert.ToString(this.ViewState["ModuleName"]); }
            set { this.ViewState["ModuleName"] = value; }
        }
     
        protected void tagsSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            ModuleViewBase viewControl = this.GetModuleViewControl();
            if (null != viewControl)
            {
                List<Guid> selectedTagIds = new List<Guid>();
                foreach (ListItem item in this.tagsSelector.Items)
                {
                    if (item.Selected)
                    {
                        selectedTagIds.Add(new Guid(item.Value));
                    }
                }
                // ***** THIS IS THE CALL THAT DOES NOT PERMANENTLY SET THE PROPERTY *****
                viewControl.FilterTags = ModuleViewBase.FiterTagStringFromTagIds(this.ModuleName, selectedTagIds);
            }
        }
     
        protected void InitializeList()
        {
            this.tagsSelector.Items.Clear();
            ModuleViewBase viewControl = this.GetModuleViewControl();
            if (null != viewControl)
            {
                //
                // The FilterTags property is stored as a String with a comma
                // separated list of Tag names.  The FilterTagsList property splits
                // that string and looks up each of the Tags in the ContentManager
                // and returns a List<ITag> of the Tags.
                //
                List<ITag> selectedTags = viewControl.FilterTagsList;
                ContentManager manager = new ContentManager(this.ModuleName);
                List<ITag> moduleTags = manager.GetTags().Cast<ITag>().ToList();
                if (null != moduleTags)
                {
                    moduleTags.ForEach(t =>
                    {
                        string tagName = t.TagName;
                        if (!String.IsNullOrEmpty(tagName))
                        {
                            bool selected = false;
                            if (selectedTags.Contains(t, new CmsITagEqualityComparer()))
                            {
                                selected = true;
                            }
                            this.tagsSelector.Items.Add(new ListItem { Text = tagName, Value = t.ID.ToString(), Selected = selected });
                        }
                    });
                }
            }
        }
     
        protected ModuleViewBase GetModuleViewControl()
        {
            ModuleViewBase moduleView = null;
            Control parent = this.Parent;
            NewsViewDesigner designer = parent as NewsViewDesigner;
            while (null != parent && null == designer)
            {
                parent = parent.Parent;
                designer = parent as NewsViewDesigner;
            }
            if (null != designer)
            {
                moduleView = designer.DesignedControl as ModuleViewBase;
            }
            return moduleView;
        }
    }


    - Back in the NewsViewControlDesigner.ascx file, I replaced the sfDesignSelectors:CategorySelector control with my own TagsSelector:
    <!-- Wizard panel 1 -->
    <div id="Panel1">
        <h3><asp:Literal ID="Literal1" runat="server" Text="<%$Resources:WhichNewsToDisplay %>"></asp:Literal></h3>
        <div>
            <gscoc:TagsSelector ID="tagsSelector" runat="server" ModuleName="Actions" ModuleTagPrefix="ACT" />
        <%-- <sfDesignSelectors:CategorySelector ID="ParentSelector" runat="server" SelectAllItemsText="Display all news" SelectSpecificItemsText="Display only news in specific categories" TypeName="Telerik.Cms.Engine.ContentManager" SelectedMethod="GetCategories" DataKey="CategoryName" />--%>
        </div>
         
        <div class="extLinks"></div>
    </div>
    <!-- end wizard panel 1 -->

    Thus, when the CMS user brings up the "Edit" dialog for one of our View controls, the designer page shows the TagsSelector control which allows them to select zero or more Tags to filter by.  The problem is that when the TagsSelector tries to set the FilterTags property on the View control, it sets it, but if I then click on the Advanced tab for the control, it gets overwritten.  The call-stacks for the three contexts in which the ModuleViewBase.FilterTags property is set when clicking on the Advanced tab can be found in a .txt file in a .zip archive at: http://files.coherentia.com/sitefinity/Callstacks_setting_FilterTags.zip.

    Thanks for any assistance.
    Dave Parker
    Coherent Interactive
    Seattle, WA


  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    06 Jan 2011
    Link to this post
    Hi Dave,

    You should inherit from the news view control designer and override the OnSaving method. Then you should pass the property set from the custom selector to the designed control as discussed in this blog post.

    Regards,
    Radoslav Georgiev
    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
  7. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    07 Jan 2011
    Link to this post
    Thanks for the reply, I did as best I could based on the blog post you referenced as well as some other blog and forum posts I found, but all of the blog posts either explain how to implement a designer for a custom UserControl, but not for a module "View" control that derives from Telerik.News.WebControls.NewsView, or the blog post refers to a previous version of Sitefinity and the information does not apply to the current version.  My current problem is that when I click on the "Edit" button from the page designer, the constructor of my designer class (which derives from Telerik.News.Design.NewsListControlDesigner) is called but before anything else is called it blows an ArgumentException saying...

    Invalid resource name (Telerik.News.Resources.ControlTemplates.Backend.NewsListControlDesigner.ascx) for assembly (App_Code.hinawkjr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) or empty template.

    I have tried several things, but cannot make this error go away.  So, in the interest of saving the 24-hour round trip of having you come back and ask for my code, here it is:

    ~/App_Code/IssueView.cs - This is the "View Control" for my Issues module.  It derives from ModuleViewBasem, which in turn, derives from Telerik.News.WebControls.NewsView.  Note that I tried with and without the ControlDesigner attribute.
    using System;
    using System.ComponentModel;
     
    [Telerik.Framework.Web.Design.ControlDesigner("IssuesViewDesigner, App_Code")]
    public class IssuesView : ModuleViewBase
    {
        public override string ProviderName
        {
            get { return "Issues"; }
        }
     
        public override string ItemListTemplatePath
        {
            get { return "~/Sitefinity/ControlTemplates/Issues/ListPageMaster.ascx"; }
        }
     
        public override string SingleItemTemplatePath
        {
            get { return "~/Sitefinity/ControlTemplates/Issues/ListPageDetails.ascx"; }
        }
    }

    ~/App_Code/IssueViewDesigner.cs - This is the designer control that derives from Telerik.News.Desing.NewsListControlDesigner.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    using Telerik.Cms.Web.UI;
    using Telerik.News;
     
    using Telerik.Framework.Web.Design;
    using Telerik.News.Design;
     
    /// <summary>
    /// Summary description for IssuesViewDesigner
    /// </summary>
    public class IssuesViewDesigner : NewsListControlDesigner
    {
        public IssuesViewDesigner()
        {
        }
     
        public override void OnSaving()
        {
            ModuleViewBase viewControl = this.DesignedControl as ModuleViewBase;
     
            if (null != viewControl)
            {
                List<Guid> selectedTagIds = this.TagsSelector.SelectedTagIds;
                if (null != selectedTagIds && selectedTagIds.Count > 0)
                {
                    viewControl.FilterTags = ModuleViewBase.FiterTagStringFromTagIds(viewControl.ProviderName, selectedTagIds);
                }
                this.ModuleViewBase.SelectAllItemsChecked = this.TagsSelector.SelectAllItems.Checked;
            }
             
            base.OnSaving();
        }
     
        public override string LayoutTemplatePath
        {
            get { return "~/Sitefinity/Admin/ControlTemplates/Issues/IssueViewControlDesigner.ascx"; }
        }
     
        protected virtual TagsSelector TagsSelector
        {
            get { return base.Container.GetControl<TagsSelector>("tagsSelector", true); }
        }
     
        protected ModuleViewBase ModuleViewBase
        {
            get { return this.DesignedControl as ModuleViewBase; }
        }
     
        protected override void InitializeControls(System.Web.UI.Control viewContainer)
        {
            this.TagsSelector.Initialize(this.ModuleViewBase);
     
        }
    }


    ~/Sitefinity/Admin/ControlTemplates/Issues/IssueViewControlDesigner.ascx - This is a direct copy of NewsViewControlDesigner.ascx except that it replaces CategorySelector with my own TagsSelector.
    <%@ Control Language="C#" %>
    <%--AutoEventWireup="true" CodeFile="IssueViewControlDesigner.ascx.cs" Inherits="Sitefinity_Admin_ControlTemplates_Issues_IssueViewControlDesigner"--%>
    <%@ Register Namespace="Telerik.Cms.Engine.WebControls.Design.Selectors" Assembly="Telerik.Cms.Engine" TagPrefix="sfDesignSelectors" %>
    <%@ Register Namespace="Telerik.Cms.Engine.WebControls.Design" Assembly="Telerik.Cms.Engine" TagPrefix="sfDesign" %>
    <%@ Register Namespace="Telerik.Cms.Engine.WebControls.Design.Settings" Assembly="Telerik.Cms.Engine" TagPrefix="sfDesignSettings" %>
    <%@ Register TagPrefix="gscoc" TagName="TagsSelector" Src="~/UserControls/Coherent_Custom_Controls/TagsSelector.ascx" %>
     
    <div class="ctrlProps">
        <div class="ctrlContent slidingWizard">
            <div id="slidingWizardSteps">
             
                <!-- Wizard panel 1 -->
                <div id="Panel1">
                    <h3><asp:Literal ID="Literal1" runat="server" Text="<%$Resources:WhichNewsToDisplay %>"></asp:Literal></h3>
                    <div>
                        <gscoc:TagsSelector ID="tagsSelector" runat="server" />
    <%--                    <sfDesignSelectors:CategorySelector ID="ParentSelector" runat="server" SelectAllItemsText="Display all news" SelectSpecificItemsText="Display only news in specific categories" TypeName="Telerik.Cms.Engine.ContentManager" SelectedMethod="GetCategories" DataKey="CategoryName" />--%>
                    </div>
                     
                    <div class="extLinks"></div>
                </div>
                <!-- end wizard panel 1 -->
                 
                <!-- wizard panel 2 -->
                <div id="Panel2">
                    <h3><asp:Literal ID="Literal2" runat="server" Text="<%$Resources:HowToOrganizeNews %>"></asp:Literal></h3>
                     
                    <div id="itemsDisplayOptions" class="contentViewDisplayOptions">
                    <ul>
                    <sfDesign:PresentationModes ID="presentationModes" runat="server">
                            <sfDesign:PresentationMode ID="listPageMode" runat="server"
                                                        ModeTitle="List & page"
                                                        ModeSettingsId="ModeSettings1"
                                                        MasterTemplateName = "Telerik.News.Resources.ControlTemplates.Frontend.Modes.ListPageMaster.ascx"
                                                        DetailTemplateName = "Telerik.News.Resources.ControlTemplates.Frontend.Modes.ListPageDetails.ascx"
                                                        CssClass="pageListMode"
                                                        SelectedCssClass="selectedOption pageListMode"
                                                        >
                                <Template>
                                    <asp:RadioButton ID="listPageRadio" runat="server" />
                                    <p>A list of news titles and summaries (optional). The full news article opens in a separate page.</p>
                                </Template>
                            </sfDesign:PresentationMode>
                    </sfDesign:PresentationModes>
                    </ul>
                     
                    </div>
                 
                </div>
                <!-- end wizard panel 2 -->
                 
                <!-- wizard sliding navigation -->
                <ol class="slidingWizardNavigation">
                    <li class="previous"><a href="#" onclick="setMovement('next'); "><strong>Settings</strong>
                        (optional)</a></li>
                    <li class="next"><a href="#" onclick="setMovement('prev'); ">Back</a></li>
                </ol>
                <!-- end wizard sliding navigation -->
                 
                <!-- wizard panel 3: optional settings for selected mode -->
                <div id="Panel3">
                <h3>News settings</h3>
                <div id="optionalSelectedMode">
                <sfDesign:PresentationModeSettings ID="ModeSettings1" runat="server">
                    <DetailHeaderTemplate>
                        <div class="selectedModeShortDescription">
                                 <h3>Selected mode</h3>
                                <h4 class="selectedTitlePageList">List & page</h4>
                                <p>A list of news titles and summaries (optional). The full news article opens in a separate page.</p>
                            </div>
                        <sfDesignSettings:PagingSetting id="pagingSetting" AllowListLimitSetting="true" DefaultListLimit="100" AllowPagingSetting="true" DefaultPageCount="10" LimitList="false" runat="server"></sfDesignSettings:PagingSetting>
                        <h4>In the news page, display:</h4>
                        <ul>
                    </DetailHeaderTemplate>
                    <DetailSettings>
                        <sfDesignSettings:TextSetting ID="setting1"
                                                  TargetID="fullContent1"
                                                  SettingTitle="Title, linking to the full article"
                                                  AllowLabelSetting="False"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="False"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="setting2"
                                                  TargetID="Publication_Date"
                                                  SettingTitle="Date"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="True"
                                                  FormatType="DateTime"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSettingContent"
                                                  TargetID="Summary"
                                                  SettingTitle="Summary"
                                                  AllowLabelSetting="false"
                                                  AllowFormatSetting="false"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True"
                                                  >
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting9"
                                                  TargetID="content"
                                                  SettingTitle="Content"
                                                  AllowLabelSetting="false"
                                                  AllowFormatSetting="false"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True"
                                                  >
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting2"
                                                  TargetID="Author"
                                                  SettingTitle="Author"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="True"
                                                  FormatType="String"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting13"
                                                  TargetID="Source"
                                                  SettingTitle="Source"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="True"
                                                  FormatType="String"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting4"
                                                  TargetID="Tags"
                                                  SettingTitle="Tags"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting5"
                                                  TargetID="Category"
                                                  SettingTitle="Category"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting7"
                                                  TargetID="Bookmarks"
                                                  SettingTitle="Social bookmarks (del.icio.us, digg, reddit)"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                    </DetailSettings>
                    <DetailFooterTemplate>
                        </ul>
                    </DetailFooterTemplate>
                    <MasterHeaderTemplate>
                        <h4>For every item in the news list, display:</h4>
                        <ul>
                    </MasterHeaderTemplate>
                    <MasterSettings>
                        <sfDesignSettings:TextSetting ID="TextSetting1"
                                                  TargetID="fullContent1"
                                                  SettingTitle="Title, linking to the full article"
                                                  AllowLabelSetting="False"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="False"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting6"
                                                  TargetID="Publication_Date"
                                                  SettingTitle="Date"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="True"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting8"
                                                  TargetID="Author"
                                                  SettingTitle="Author"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                        <sfDesignSettings:TextSetting ID="TextSetting14"
                                                  TargetID="Source"
                                                  SettingTitle="Source"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="True"
                                                  FormatType="String"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                        </sfDesignSettings:TextSetting>
                          <sfDesignSettings:TextSetting ID="TextSettingContent2"
                                                  TargetID="Summary"
                                                  SettingTitle="Summary"
                                                  AllowLabelSetting="false"
                                                  AllowFormatSetting="false"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                          <sfDesignSettings:TextSetting ID="TextSetting3"
                                                  TargetID="fullContent2"
                                                  SettingTitle="Permanent link"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                          </sfDesignSettings:TextSetting>
                          <sfDesignSettings:TextSetting ID="TextSetting12"
                                                  TargetID="ThumbnailHolder"
                                                  SettingTitle="Thumbnail"
                                                  AllowLabelSetting="false"
                                                  AllowFormatSetting="false"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                          <sfDesignSettings:TextSetting ID="TextSetting10"
                                                  TargetID="Tags"
                                                  SettingTitle="Tags"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                          <sfDesignSettings:TextSetting ID="TextSetting11"
                                                  TargetID="Category"
                                                  SettingTitle="Category"
                                                  AllowLabelSetting="True"
                                                  AllowFormatSetting="False"
                                                  AllowVisibilitySetting="True"
                                                  TargetVisibleByDefault="True">
                                                  </sfDesignSettings:TextSetting>
                    </MasterSettings>
                    <MasterFooterTemplate>
                        </ul>
                        <sfDesignSettings:BehaviorSetting id="behaviorSetting" runat="server"></sfDesignSettings:BehaviorSetting>
                    </MasterFooterTemplate>
                    </sfDesign:PresentationModeSettings>
                </div>
                </div>
            </div>
        </div>
    </div>
     
    <asp:HiddenField ID="designerIsDirty" runat="server" />
    <asp:HiddenField ID="selectedModeIdField" runat="server" />
    <asp:HiddenField ID="selectedModeClientIdField" runat="server" />
     
    <script type="text/javascript">
     
        var eventsOptionsItems = document.getElementById("itemsDisplayOptions").getElementsByTagName("LI");
     
        if (eventsOptionsItems) {
     
     
            for (var i = 0; i < eventsOptionsItems.length; i++) {
     
                eventsOptionsItems[i].onclick = function () {
                    this.getElementsByTagName("input")[0].click();
                }
     
            }
        }
    </script>

    ~/App_Data/Configuration/Telerik.Sitefinity.Configuration.ControlsConfig.xml - Showing only the mapping of the external template for the Issues NewsViewControlDesigner.  Note that I tried both with and without this code (since it seemed like the LayoutTemplatePath override in IssueViewDesigner.ascx would take care of this.
    <?xml version="1.0" encoding="utf-8"?>
    <controlsConfig>
        <viewMap>
            <viewSettings hostType="Telerik.News.WebControls.Design.NewsViewDesigner">
                <additionalTemplates>
                    <add key="Issues" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Issues/IssueViewControlDesigner.ascx" />
                </additionalTemplates>
            </viewSettings>
             
            <!-- other stuff -->
             
        </viewMap>
    </controlsConfig>

    Thanks,
    Dave Parker
    Coherent Interactive
    Seattle, WA

  8. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    10 Jan 2011
    Link to this post
    Hi Ivan,

    Did you have a response on this? I am still unable to get past the ArgumentException that I described in my previous post. I searched more and tried more things, but have not found a solution yet.  Have you had any success in figuring out where my problem is?

    Thanks,
    Dave Parker
    Coherent Interactive
    Seattle, WA
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jan 2011
    Link to this post
    Hi Dave,

    This error

    "Invalid resource name (Telerik.News.Resources.ControlTemplates.Backend.NewsListControlDesigner.ascx) for assembly (App_Code.hinawkjr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) or empty template."

    says that the template for your control designer cannot be found. Which version of Sitefinity you use? The designer class you use is not supposed to be used since Sitefinity 3.6. We use NewsViewDesigner which inherits from ContentViewDesignerBase. Since 3.6 we implemented the embedded resources and template parsing. If you use an older version you cannot use ControlsConfig file. If you are on 3.6 or 3.7, please inherit from the NewsViewDesigner or ContentViewDesignerBase.

    All the best,
    Ivan Dimitrov
    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
  10. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    12 Jan 2011
    Link to this post
    I changed...

    public class IssuesViewDesigner : NewsListControlDesigner

    ...to...

    public class IssuesViewDesigner : NewsViewDesigner

    ...but still got the same error.  Is there a way for me to determine which template it is trying to find but cannot?  In the past (in C/C++ native code days) I would examine the stack frame for the failing call and dereference the pointer to the string containing the template reference, but I am not sure that will work with managed code strings.

    Thanks,
    Dave Parker
    Coherent Interactive
    Seattle, WA
  11. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    12 Jan 2011
    Link to this post
    Oh, and to answer your question about versions, this is from my initial post on this thread:

    Platform: Sitefinity 3.7 SP4, .NET 3.5

    Dave Parker
    Coherent Interactive
    Seattle, WA
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Jan 2011
    Link to this post
    Hello Dave,

    If you use SP4 inherit from NewsViewDesigner and override DesignerTemplatePath to set the path to the template.

    Kind regards,
    Ivan Dimitrov
    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
    Answered
  13. Dave
    Dave avatar
    20 posts
    Registered:
    10 Aug 2010
    13 Jan 2011
    Link to this post
    Yes!  That was the final magic incantation to make this work.  Thank you so very much for your patience with me.
Register for webinar
13 posts, 1 answered