More in this section

Forums / Developing with Sitefinity / Products module: Removing unneeded Generic Content features

Products module: Removing unneeded Generic Content features

3 posts, 1 answered
  1. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    10 Jul 2009
    Link to this post
    Following this (http://blogs.sitefinity.com/ivan/posts/09-03-23/Products_module_Removing_unneeded_Generic_Content_features.aspx) article on the blog i tried to remove the tags section in the ProductEditView.

    I have added a div around the tag section. Like this:

     

     

    <div  id="tagsPanel" runat="server">  
                             <h3> 
                                <asp:Literal ID="Literal11" runat="server" Text="<%$Resources:Tags %>"></asp:Literal></h3>  
                            <fieldset class="set">  
                                <ol class="setIn">  
                                    <li class="tags">  
                                        <sf:ContentTagEditor ID="tagsControl" runat="server" /> 
                                    </li> 
                                </ol> 
                            </fieldset> 
                            </div> 

    I have then added this in ProductEditView.cs:

     

     

    using System.Web.UI;  
     
     
    protected Control TagsPanel  
     
    {  
     
    get 
     
    {  
     
    return base.Container.GetControl<Control>("tagsPanel"false);  
     
    }  
     
    }  
     
     
    protected override void InitializeControls(Control viewContainer)  
     
    {  
     
    base.InitializeControls(viewContainer);  
     
    if (this.TagsPanel != null)  
     
    this.TagsPanel.Visible = false;  
     
    }   
     

    Compiled the code and ran the site. But when i go to edit, it simply apears as normal. Nothing at all has changed.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Jul 2009
    Link to this post
    Hi Andrew,

    The problem is that the div you added cannot be found and it returns null.

    There are two options.

    1. Set the div as hidden directly in the control declaration.

    <div id="divHidden" runat="server" visible="false"
     
    // add controls here 
     
    </div> 

    2. Use the following approach to get the control

      protected Control DivHidden 
            { 
                get 
                { 
                    return base.Container.GetControl<Control>("divHidden"false, Telerik.Framework.Web.TraverseMethod.BreadthFirst); 
                } 
            } 

    I hope this helps.

    Regards,
    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.
    Answered
  3. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    10 Jul 2009
    Link to this post
    Thanks.
Register for webinar
3 posts, 1 answered