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

Forums / Developing with Sitefinity / custom ditributable newsview

custom ditributable newsview

15 posts, 1 answered
  1. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    29 Oct 2009
    Link to this post
    Hello Ivan,

    I try to make a custom ditributable newsview
    I used ListPageMaster.ascx as a template.
    After builing de dll and dropping the new control on my page in sitefinity i get a control with a message in it source with key go back not found.
    In edit mode i get an error value can not be null parametername viewname.

    I suppose that i need to add some code to get the viewname but wonder how to do that

    Please help 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Oct 2009
    Link to this post
    Hello Mart,

    Most probably you have missed to add the local resources for the template which causes the errors you are getting.

    Kind regards,
    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.
  3. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    29 Oct 2009
    Link to this post
    Hello again,

    I have put a copy of  ListPageMaster.ascx.resx in a App_LocalResources folder which is in the same folder as the ListPageMaster.ascx file. This file is also embedded Resource
    But it still doestn't work.

    what are i doing wrong?

    Mart
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Oct 2009
    Link to this post
    Hi Mart,

    Could you send us the error you are getting, it is not clear what the exact problem is.

    Sincerely yours,
    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.
  5. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    29 Oct 2009
    Link to this post
    Hello Ivan,

    It seems you are right. .rsx not to be found but it realy is in my app_resources folder in the project
    the template is used in news.cs

    I have attached
    1. the message on the page
    2. the message in edit mode of the control
    3. The project structure

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Oct 2009
    Link to this post
    Hello Mart,

    Do you use WebSysTemplate class to embed the templates

    [WebSysTemplate(CustomNewsView.CustomNewsViewItemListTemplateName, "Template_Desc", "/News", true, "2009-02-17")]

    How do you make reference to the templates. May I see the code of the control.

    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.
  7. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    29 Oct 2009
    Link to this post
    Ivan,

    this is my news.cs content

    using

     

    System;

     

    using

     

    System.Collections.Generic;

     

    using

     

    System.Linq;

     

    using

     

    System.Text;

     

    using

     

    System.Web.UI.HtmlControls;

     

    using

     

    System.Web.UI.WebControls;

     

    using

     

    Telerik.Framework.Web;

     

    using

     

    Telerik.Cms.Web;

     

    using

     

    Telerik.Framework.Web.Design;

     

    using

     

    System.Web.UI;

     

    namespace

     

    ArtisteerAddon

     

    {

     

    class News : Telerik.Framework.Web.Design.ControlDesigner

     

     

    {

     

    protected override void CreateChildControls()

     

    {

     

    Control control = ControlUtils.GetTemplateFromResource("ArtisteerAddon.Resources.Templates.ListPageMaster.ascx", this.GetType());

     

    Controls.Add(control);

    }

    }

    }

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Oct 2009
    Link to this post
    Hello Mart,


    1.First you are inheriting from ControlDesigner which is not correct, you should inherit from NewsView or ContentView.

    2. You should override SingleItemTemplatePath, ItemListTemplatePath, ItemListTemplateName, SingleItemTemplateName and LocalizationAssemblyInfo

    Best wishes,
    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.
  9. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    30 Oct 2009
    Link to this post
    Hello Ivan,

    Thanks for you help so far.
    Your response-times are realy is amazing.

    Yet I'm having a next question: Is there some documentation on this or an example?

    Hope you will help me,

    Mart
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Oct 2009
    Link to this post
    Hello Mart,

    Here is a sample code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Telerik.News.WebControls;
     
    namespace NewsViewCustomControl
    {
        public class News : NewsView
        {
            public override string ItemListTemplateName
            {
                get
                {
                    return News.NewsViewCustomItemListTemplateName;
                }
            }
     
            /// <summary>
            /// Gets the name of the embedded layout template. If the control uses layout template
            /// this property must be overridden to provide the path (key) to an embedded resource file.
            /// </summary>
            /// <value></value>
            public override string SingleItemTemplateName
            {
                get
                {
                    return News.NewsViewCustomSingleItemTemplateName;
                }
            }
     
            public override Type AssemblyInfo
            {
                get
                {
                    return typeof(News);
                }
                set
                {
                    base.AssemblyInfo = value;
                }
            }
     
     
     
            #region Constants
     
            private const string NewsViewCustomItemListTemplateName = "NewsViewCustomControl.Resources.ListPageMaster.ascx";
     
            private const string NewsViewCustomSingleItemTemplateName = "NewsViewCustomControl.Resources.ListPageDetails.ascx";
     
            #endregion
        }
    }

    Here ListPageDetails and ListPageMaster should be build as Embedded resources - in Visual Studio - right Click over the files and select Build Action.
    Also you need to use Messages.resx file that could be located under Resources directory.


    Sincerely yours,
    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.
  11. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    30 Oct 2009
    Link to this post
    Hello Ivan,

    I do not understand your last sentence in your last post:
    "Also you need to use Messages.resx file that could be located under Resources directory."

    Where can I find this messages.resx file?
    Do I have to add something to properties.assembly?


  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Oct 2009
    Link to this post
    Hello Mart,

    Messages.resx should collect the same data as App_LocalResources - it is used to store resources.

    Kind regards,
    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.
  13. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    30 Oct 2009
    Link to this post
    Hello Ivan,

    This works.

    Thank You ver much

    Could you please answer my other question I posted about Jquery recently?
    it in Generic Content With Expend list

    Mart 
  14. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    03 Nov 2009
    Link to this post
    Hello,

    another question:

    How can I localize a custom distributable control

    I understand that the rseources are in de messages.resx but how to implement this in the same way Sitefinty does
    I mean in app_localresources folder

    Mart
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    03 Nov 2009
    Link to this post
    Hi Mart,

    If you are going to use embedded templates and resources you should compile the resources each time. You can also map the templates through the public properties and use App_LocalResources folder. Here is an article that describes resources and localization in .NET.

    Regards,
    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.
    Answered
Register for webinar
15 posts, 1 answered