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

Forums / Bugs & Issues / Issue in Generic Product Module

Issue in Generic Product Module

6 posts, 0 answered
  1. Galia Aidemirska
    Galia Aidemirska avatar
    3 posts
    Registered:
    18 Sep 2012
    31 Aug 2009
    Link to this post

    I downloaded the "Sample Generic Content based module: Products module" from http://www.sitefinity.com/blogs/ivan/posts/09-03-11/sample_generic_content_based_module_products_module.aspx. I'm using Sitefinity 3.7 standard trial.
    The set up went fine, but I'm getting exception when viewing list of created Products by Tag:

    The ViewMode "ContentItemsView" is not defined for this control.

    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.ArgumentException: The ViewMode "ContentItemsView" is not defined for this control.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: The ViewMode "ContentItemsView" is not defined for this control.]
       Telerik.Cms.Web.UI.ViewModeControl`1.get_CurrentView() +146
       Telerik.Cms.Web.UI.ViewModeControl`1.LoadCurrentView(Control owner) +25
       Telerik.Cms.Web.UI.ViewModeControl`1.InitializeControls(Control viewContainer) +42
       Telerik.Cms.Web.UI.Backend.ControlPanel`1.InitializeControls(Control container) +23
       Telerik.Cms.Web.UI.ViewModeControl`1.CreateChildControls() +101
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
    


    In the documentation it is stated that the ProductsTagsView is a "Barely modified Views".

    What would be the solution? Creating a new Template and placing in the Telerik.Samples.Products.Resources.ControlTemplates.Backend folder?

    Thanks,
    Galina
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    01 Sep 2009
    Link to this post
    Hello Galia Aidemirska,

    Please check whether AssemblyInfo and LocalizationAssemblyInfo  are overridden in your template.

    public override Type AssemblyInfo 
            { 
                get 
                { 
                    return typeof(ProductsControlPanel); 
                } 
                set 
                { 
                    base.AssemblyInfo = value; 
                } 
            } 
             
            public override Type LocalizationAssemblyInfo 
            { 
                get 
                { 
                    return typeof(ProductsControlPanel); 
                } 
                set 
                { 
                    base.LocalizationAssemblyInfo = value; 
                } 
            } 

    Also check whether the template for this view is build as embedded resources from its properties. By default there is not template created for this view. You can implement it by overriding LayoutTemplateName and LayoutTemplatePath properties. Then you can embed your template. You can download sample TagsView template from ExternalTemplates archive available for downloading under downloads section of your account.

    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.
  3. Galia Aidemirska
    Galia Aidemirska avatar
    3 posts
    Registered:
    18 Sep 2012
    01 Sep 2009
    Link to this post
    Hi Ivan,

    Thank you for the response. I'm still new with Sitefinity and teh notion of nesting Views. I downloaded the TagsView.ascx which comes when I download the ExternalTemplates.
    I added TagsView.ascx to Telerik.Samples.Products.Resources.ControlTemplates.Backend.
    Then I modified the ProductsTagsView.cs to point to the new template.

    public override Type AssemblyInfo
            {
                get
                {
                    return typeof(ProductsControlPanel);
                }
                set
                {
                    base.AssemblyInfo = value;
                }
            }

    protected override string LayoutTemplateName
            {
                get
                {
                    return ProductsTagsView.layoutTemplateName;
                }
            }

    [WebSysTemplate(ProductsTagsView.layoutTemplateName, "ProductsTagsView_Template_Desc", "/Stories", false, "2009-04-10")]
            public override string LayoutTemplatePath
            {
                get
                {
                    return base.LayoutTemplatePath;
                }
                set
                {
                    base.LayoutTemplatePath = value;
                }
            }

            private const string layoutTemplateName =
                "Telerik.Samples.Products.Resources.ControlTemplates.Backend.TagsView.ascx";

    The problem still stays. Overall the ProductsTagsView works - I can add, delete, rename tags (as long as I stay on the same View/page).
    But when I click on any of the Link buttons (with ID="tags") within the corresponding MultiView/view/Repeater/RepeaterItem, I receive the same exception I posted yesterday. This is the control which when clicked and post back causes the problem:
    <asp:LinkButton ID="tag" runat="server" ToolTip="Click to view all posts tagged with this tag."></asp:LinkButton>

    The URL I'm navigated to is:

    http://localhost/DemoSite/Sitefinity/Admin/Modules.aspx?module=Products&route=ProductsControlPanel.ContentItemsView&Param=Tag.Name+%3d+%22Afternoon+Tea%22

    What I would want teh URL to be is:
    http://localhost/DemoSite/Sitefinity/Admin/Modules.aspx?module=Products&route=ProductsControlPanel.ProductsView&Param=Tag.Name+%3d+%22Afternoon+Tea%22

    How do I do that? I tried to override the CreateChildControls() of the ProductsTagsView, but it is clumzy to look through all controls andneted repeater to generate the correct URLs. Looking at the News module, the URL looks like:

    http://localhost/DemoSite/Sitefinity/Admin/Modules.aspx?module=News&route=NewsControlPanel.NewsItemsView&Param=Tag.Name+%3d+%22Sports%22

    Thank you in advance.

    Galina

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    03 Sep 2009
    Link to this post
    Hello Galia Aidemirska,

    Please override following method - RedirectOnOpenContent as the example below shows:

    protected override void RedirectOnOpenContent(string filterExpr) 
            { 
                NavigateHostCommand<ProductsView>(filterExpr); 
            } 

    This should fix the problem with the routing. As for the first issue make sure that the host of all views added under ProductsView (ProductsItemListView, ProductEditView, ProductHistoryView etc) is ProductsView.

    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.
  5. Galia Aidemirska
    Galia Aidemirska avatar
    3 posts
    Registered:
    18 Sep 2012
    04 Sep 2009
    Link to this post
    Thank you. This is exactly what I was looking for.

    Galina
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    04 Sep 2009
    Link to this post
    Hi Galia Aidemirska,

    Glad to hear that everything is working fine.

    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.
Register for webinar
6 posts, 0 answered