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

Custom Module

16 posts, 0 answered
  1. Kamal
    Kamal avatar
    16 posts
    Registered:
    27 Nov 2010
    11 Jan 2011
    Link to this post
    Hi

    I just follow the online documentation to install the product-category module, everything seems work. but when I try to add category, I receive the following errors

    A required control was not found in the template for "~/Sitefinity/Admin/ControlTemplates/Products/CategoriesManagement.ascx". The control must be assignable form type "Telerik.Web.UI.RadTreeView" and must have ID "categoriesTreeView".
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jan 2011
    Link to this post
    Hello Kamal,

    Please make sure that you have the following control in CategoriesManagement.ascx

    <telerik:RadTreeView ID="categoriesTreeView" runat="server" EnableEmbeddedSkins="false" Skin="HierarchyCategories" CollapseAnimation-Type="None" ExpandAnimation-Type="None">
              <NodeTemplate>
                
                  <asp:LinkButton ID="categoryNameButton" runat="server" Text='<%# Eval("CategoryName") %>' CssClass="categoryTitle" />
                
                
                  <asp:Label ID="itemsCount" runat="server" CssClass="categoryItemCount" />
                
                   <div class="categoryAddNewCategory">
                      <div id="subcategoryPopup<%# Eval("ID") %>" class="editItemPropertiesForm addNewCategory" style="display:none">
                          <asp:Label ID="Label77" runat="server" Text='<%$Resources:SubcategoryName %>' AssociatedControlID="subcategoryName"></asp:Label>
                          <asp:TextBox ID="subcategoryName" runat="server" ValidationGroup="subcategory" CssClass="txt" MaxLength="250"></asp:TextBox>
                          <asp:RequiredFieldValidator ID="rfvSubcategory" runat="server" ControlToValidate="subcategoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="subcategory"><strong><asp:Literal ID="Literal77" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                          <p class="button_area">
                              <asp:LinkButton ID="btnSubmitSubcategory" runat="server" ValidationGroup="subcategory" CssClass="CmsButLeft okdark"><asp:Literal ID="Literal66" runat="server" Text='<%$Resources:AddSubcategory %>'></asp:Literal></asp:LinkButton>
                              <span class="cmsorlbl"><asp:Literal ID="Literal44" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                              <a href="#" class="min" onclick="ToggleDiv('subcategoryPopup<%# Eval("ID") %>'); return false;" title="Close"><asp:Literal ID="Literal33" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                          </p>
                      </div>
                      <asp:LinkButton ID="popupSubcategoryButton" runat="server" Text="Add a subcategory" CssClass="addCategoryName"></asp:LinkButton>
                   </div>
                   <div class="categoryEditCategory">
                      <div id="renamePopup<%# Eval("ID") %>" class="editItemPropertiesForm" style="display:none">
                          <div class="multiplePropertyEdit">
                              <strong class="multiplePropertyTitle"><asp:Literal ID="Label1" runat="server" Text='<%$Resources:EditThisCategory %>'></asp:Literal></strong>
                              <asp:Label ID="Label2" runat="server" Text='<%$Resources:CategoryName %>' AssociatedControlID="categoryName"></asp:Label>
                              <asp:TextBox ID="categoryName" runat="server" ValidationGroup="categoryRename" CssClass="txt" MaxLength="250"></asp:TextBox>
                              <asp:RequiredFieldValidator ID="rfvRename" runat="server" ControlToValidate="categoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="categoryRename"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                               
                              <asp:Label ID="Label3" runat="server" Text='<%$Resources:ThisCategoryIsSubcategoryOf %>' AssociatedControlID="parentCategoriesList"></asp:Label>
                              <telerik:RadComboBox ID="parentCategoriesList" EnableEmbeddedSkins="true" Skin="WebBlue" runat="server"></telerik:RadComboBox>
                          </div>
                           
                          <p class="button_area">
                              <asp:LinkButton ID="btnSubmitRename" runat="server" ValidationGroup="categoryRename" CssClass="CmsButLeft okdark"><asp:Literal ID="Literal6" runat="server" Text='<%$Resources:Update %>'></asp:Literal></asp:LinkButton>
                              <span class="cmsorlbl"><asp:Literal ID="Literal4" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                              <a href="#" class="min" onclick="ToggleDiv('renamePopup<%# Eval("ID") %>'); return false;" title="Close"><asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                          </p>
                      </div>
                      <asp:LinkButton ID="popupRenameButton" runat="server" Text='<%$Resources:Edit %>' CssClass="renameCategoryName"></asp:LinkButton>
                   </div>
                   <div class="categoryDeleteCategory">
                      <asp:LinkButton ID="deleteCategoryButton" runat="server" Text='<%$Resources:Delete %>'></asp:LinkButton>
                   </div>
          </NodeTemplate>
      </telerik:RadTreeView>


    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. Kamal
    Kamal avatar
    16 posts
    Registered:
    27 Nov 2010
    11 Jan 2011
    Link to this post
    Hi Ivan,

    Sorry ivan , this control does not exist in your sample code. If you want to make it in Categorymangement.aspx page then where it needs to place.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jan 2011
    Link to this post
    Hi Kamal,
    <%@ Register TagPrefix="sfMsg" Namespace="Telerik.Cms.Web.UI" Assembly="Telerik.Cms.Web.UI" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
     
    <div id="divWorkArea" runat="server" class="workArea insert">
    <sfmsg:messagecontrol runat="server" id="message1">
        <ItemTemplate>
            <asp:Label runat="server" ID="messageText"></asp:Label>
        </ItemTemplate>
    </sfmsg:messagecontrol>
    <div class="mainForm">
    <fieldset class="addNewItem">
    <asp:Label ID="lblAddCategory" runat="server" Text='<%$Resources:AddACategory %>' AssociatedControlID="categoryName"></asp:Label>
    <asp:TextBox ID="categoryName" runat="server" CssClass="txt" MaxLength="250"></asp:TextBox>
    <asp:LinkButton ID="addCategory" runat="server" ValidationGroup="newCategory" CssClass="CmsButLeft okdark"><strong class="CmsButRight dark"><asp:Literal ID="Literal1" runat="server" Text='<%$Resources:Add %>'></asp:Literal></strong></asp:LinkButton>
    <asp:RequiredFieldValidator Display="Dynamic" ID="rfvNewCategory" runat="server" ControlToValidate="categoryName" Text='<%$Resources:NewCategoryEmpty %>' ErrorMessage='<%$Resources:NewCategoryEmpty %>' ValidationGroup="newCategory" CssClass="validMessage"></asp:RequiredFieldValidator>
    </fieldset>
    <h2>Categories</h2>
     
    <telerik:RadGrid ID="gridCategories" runat="server" AutoGenerateColumns="false" AllowSorting="true">
        <MasterTableView CssClass="listItems listCategories" Width="100%">
            <Columns>
                <telerik:GridBoundColumn UniqueName="CategoryName" DataField="CategoryName" HeaderText='<%$Resources:Category %>' SortExpression="CategoryName"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%$Resources:Items %>'></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="contentCountButton" runat="server"></asp:LinkButton>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <div class="editItemPropertiesFormWrapper">
                    <div id="subcategoryPopup<%# Eval("CategoryName") %>" class="editItemPropertiesForm" style="display:none">
                        <asp:Label ID="Label77" runat="server" Text='<%$Resources:SubcategoryName %>' AssociatedControlID="subcategoryName"></asp:Label>
                        <asp:TextBox ID="subcategoryName" runat="server" ValidationGroup="subcategory" CssClass="txt" MaxLength="250"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvSubcategory" runat="server" ControlToValidate="subcategoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="subcategory"><strong><asp:Literal ID="Literal77" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                        <p class="button_area">
                            <asp:LinkButton ID="btnSubmitSubcategory" runat="server" ValidationGroup="subcategory" CssClass="CmsButLeft okdark"><strong class="CmsButRight dark"><asp:Literal ID="Literal66" runat="server" Text='<%$Resources:AddSubcategory %>'></asp:Literal></strong></asp:LinkButton>
                            <span class="cmsorlbl"><asp:Literal ID="Literal44" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                            <a href="#" class="min" onclick="ToggleDiv('subcategoryPopup<%# Eval("CategoryName") %>'); return false;" title="Close"><asp:Literal ID="Literal33" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                        </p>
                    </div>
                    </div>
                    <asp:LinkButton ID="popupSubcategoryButton" runat="server" Text="Add a subcategory" CssClass="renameCategoryName"></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle CssClass="gridActions" />
                </telerik:GridTemplateColumn>           
                <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <div class="editItemPropertiesFormWrapper">
                    <div id="renamePopup<%# Eval("CategoryName") %>" class="editItemPropertiesForm" style="display:none">
                        <asp:Label ID="Label2" runat="server" Text='<%$Resources:RenameThisCategory %>' AssociatedControlID="categoryName"></asp:Label>
                        <asp:TextBox ID="categoryName" runat="server" ValidationGroup="categoryRename" CssClass="txt" MaxLength="250"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvRename" runat="server" ControlToValidate="categoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="categoryRename"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                        <p class="button_area">
                            <asp:LinkButton ID="btnSubmitRename" runat="server" ValidationGroup="categoryRename" CssClass="CmsButLeft okdark"><strong class="CmsButRight dark"><asp:Literal ID="Literal6" runat="server" Text='<%$Resources:Rename %>'></asp:Literal></strong></asp:LinkButton>
                            <span class="cmsorlbl"><asp:Literal ID="Literal4" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                            <a href="#" class="min" onclick="ToggleDiv('renamePopup<%# Eval("CategoryName") %>'); return false;" title="Close"><asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                        </p>
                    </div>
                    </div>
                    <asp:LinkButton ID="popupRenameButton" runat="server" Text="Rename" CssClass="renameCategoryName"></asp:LinkButton>
                </ItemTemplate>
            <ItemStyle CssClass="gridActions" />
            </telerik:GridTemplateColumn>
            <telerik:GridButtonColumn Text='<%$Resources:Delete %>' CommandName="Delete"></telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
     
    <asp:PlaceHolder ID="emptyWindow" runat="server">
    <div id="empty">
        <h2 class="gridTitle"><asp:Literal ID="Literal5" runat="server" Text="<%$Resources:NoCategories %>"></asp:Literal></h2>
    </div>
    </asp:PlaceHolder>
     
    </div>
    <div class="info" id="divFaq" runat="server">
        <div class="infoBottom">
            <h3>Category FAQs</h3>
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:GenericContentCategoriesFAQText %>"></asp:Literal>
            <p class="hideAllFAQs">
                <a href="javascript:void(0)" onclick="javascript:Personalization.hideFaqSection('<%= divFaq.ClientID %>')">Hide FAQs everywhere</a>
            </p>
        </div>
    </div>
    <div class="clear"><!-- --></div>
    </div>


    Here is the entire template




    Best wishes,
    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. Kamal
    Kamal avatar
    16 posts
    Registered:
    27 Nov 2010
    11 Jan 2011
    Link to this post
    Hi Ivan,

    Thanks for your quick reply. But I am getting problem with resource file, could you send me resource file also.

    I am still getting the error

    A required control was not found in the template for "~/Sitefinity/Admin/ControlTemplates/Images/CategoriesManagement.ascx". The control must be assignable form type "Telerik.Web.UI.RadTreeView" and must have ID "categoriesTreeView".



    I used the template given above by you, but in this template I am not finding RadTreeView control even though you have given me the code with RadTreeview control in first reply. Could you tell me where I am doing wrong?

    IF I remove RadGrid Control from the template and place the RadTreeView control then I will get this error

    A required control was not found in the template for "~/Sitefinity/Admin/ControlTemplates/Images/CategoriesManagement.ascx". The control must be assignable form type "Telerik.Web.UI.RadComboBox" and must have ID "parentCategoriesList".

    Even though this named control exists in the template after that It's giving error. I tried to move this control here and there but It does not work. Please suggest , it's urgent.
  6. cons
    cons avatar
    7 posts
    Registered:
    07 Apr 2011
    04 May 2011
    Link to this post
    Any solution for the above said problem please?
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 May 2011
    Link to this post
    Hi ,

    The error is not related to the resources. It says that you are missing required controls with the specified IDs. Please check your template for these controls.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. cons
    cons avatar
    7 posts
    Registered:
    07 Apr 2011
    11 May 2011
    Link to this post
    Ivan,

    Can you give us the perfect template without these errors?
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 May 2011
    Link to this post
    Hello cons,

    I replied to the support request (420723)you opened about the  same issue. Please check your tickets.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    13 Dec 2011
    Link to this post
    I got exactly the same error. Can anyone help me out? What is the code for CategoriesManagement.ascx?  Thanks.

    Stephen
  11. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    16 Dec 2011
    Link to this post
    Hi Stephen,

    Please find below the default template we're using for Categories management:
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sfMsg" Namespace="Telerik.Cms.Web.UI" Assembly="Telerik.Cms.Web.UI" %>
      
    <div id="divWorkArea" runat="server" class="workArea insert">
        <sfMsg:MessageControl runat="server" id="message1">
            <ItemTemplate>
                <asp:Label runat="server" ID="messageText"></asp:Label>
            </ItemTemplate>
        </sfMsg:MessageControl>
        <div class="mainForm">
            <fieldset class="addNewItem">
                <ol class="addCategoryItem">
                    <li>
                        <asp:Label ID="lblAddCategory" runat="server" Text='<%$Resources:AddACategory %>' AssociatedControlID="categoryName"></asp:Label>
                        <asp:TextBox ID="categoryName" runat="server" CssClass="txt" MaxLength="250"></asp:TextBox>
                    </li>
                    <li>
                        <asp:Label ID="parentCategory" runat="server" Text='<%$Resources:ThisCategoryIsSubcategoryOf %>' AssociatedControlID="parentCategoriesList"></asp:Label>
                        <telerik:RadComboBox ID="parentCategoriesList" EnableEmbeddedSkins="true" Skin="WebBlue" runat="server"></telerik:RadComboBox>
                    </li>
                </ol>
                <asp:LinkButton ID="addCategory" runat="server" ValidationGroup="newCategory" CssClass="CmsButLeft okdark"><strong class="CmsButRight dark"><asp:Literal ID="Literal1" runat="server" Text='<%$Resources:Add %>'></asp:Literal></strong></asp:LinkButton>
                <asp:RequiredFieldValidator Display="Dynamic" ID="rfvNewCategory" runat="server" ControlToValidate="categoryName" Text='<%$Resources:NewCategoryEmpty %>' ErrorMessage='<%$Resources:NewCategoryEmpty %>' ValidationGroup="newCategory" CssClass="validMessage"></asp:RequiredFieldValidator>
      
            </fieldset>
            <h2>Categories</h2>
      
            <telerik:RadTreeView ID="categoriesTreeView" runat="server" EnableEmbeddedSkins="false" Skin="HierarchyCategories" CollapseAnimation-Type="None" ExpandAnimation-Type="None">
                <NodeTemplate>
                   
                    <asp:LinkButton ID="categoryNameButton" runat="server" Text='<%# Eval("CategoryName") %>' CssClass="categoryTitle" />
                   
                   
                    <asp:Label ID="itemsCount" runat="server" CssClass="categoryItemCount" />
                   
                     <div class="categoryAddNewCategory">
                        <div id="subcategoryPopup<%# Eval("ID") %>" class="editItemPropertiesForm addNewCategory" style="display:none">
                            <asp:Label ID="Label77" runat="server" Text='<%$Resources:SubcategoryName %>' AssociatedControlID="subcategoryName"></asp:Label>
                            <asp:TextBox ID="subcategoryName" runat="server" ValidationGroup="subcategory" CssClass="txt" MaxLength="250"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvSubcategory" runat="server" ControlToValidate="subcategoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="subcategory"><strong><asp:Literal ID="Literal77" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                            <p class="button_area">
                                <asp:LinkButton ID="btnSubmitSubcategory" runat="server" ValidationGroup="subcategory" CssClass="CmsButLeft okdark"><asp:Literal ID="Literal66" runat="server" Text='<%$Resources:AddSubcategory %>'></asp:Literal></asp:LinkButton>
                                <span class="cmsorlbl"><asp:Literal ID="Literal44" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                                <a href="#" class="min" onclick="ToggleDiv('subcategoryPopup<%# Eval("ID") %>'); return false;" title="Close"><asp:Literal ID="Literal33" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                            </p>
                        </div>
                        <asp:LinkButton ID="popupSubcategoryButton" runat="server" Text="Add a subcategory" CssClass="addCategoryName"></asp:LinkButton>
                     </div>
                     <div class="categoryEditCategory">
                        <div id="renamePopup<%# Eval("ID") %>" class="editItemPropertiesForm" style="display:none">
                            <div class="multiplePropertyEdit">
                                <strong class="multiplePropertyTitle"><asp:Literal ID="Label1" runat="server" Text='<%$Resources:EditThisCategory %>'></asp:Literal></strong>
                                <asp:Label ID="Label2" runat="server" Text='<%$Resources:CategoryName %>' AssociatedControlID="categoryName"></asp:Label>
                                <asp:TextBox ID="categoryName" runat="server" ValidationGroup="categoryRename" CssClass="txt" MaxLength="250"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvRename" runat="server" ControlToValidate="categoryName" Display="Dynamic" CssClass="validMessage" EnableViewState="False" SetFocusOnError="True" ValidationGroup="categoryRename"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:CategoryNameEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                                  
                                <asp:Label ID="Label3" runat="server" Text='<%$Resources:ThisCategoryIsSubcategoryOf %>' AssociatedControlID="parentCategoriesList"></asp:Label>
                                <telerik:RadComboBox ID="parentCategoriesList" EnableEmbeddedSkins="true" Skin="WebBlue" runat="server"></telerik:RadComboBox>
                            </div>
                              
                            <p class="button_area">
                                <asp:LinkButton ID="btnSubmitRename" runat="server" ValidationGroup="categoryRename" CssClass="CmsButLeft okdark"><asp:Literal ID="Literal6" runat="server" Text='<%$Resources:Update %>'></asp:Literal></asp:LinkButton>
                                <span class="cmsorlbl"><asp:Literal ID="Literal4" runat="server" Text="<%$Resources:Or %>"></asp:Literal></span>
                                <a href="#" class="min" onclick="ToggleDiv('renamePopup<%# Eval("ID") %>'); return false;" title="Close"><asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Close %>"></asp:Literal></a>
                            </p>
                        </div>
                        <asp:LinkButton ID="popupRenameButton" runat="server" Text='<%$Resources:Edit %>' CssClass="renameCategoryName"></asp:LinkButton>
                     </div>
                     <div class="categoryDeleteCategory">
                        <asp:LinkButton ID="deleteCategoryButton" runat="server" Text='<%$Resources:Delete %>'></asp:LinkButton>
                     </div>
            </NodeTemplate>
        </telerik:RadTreeView>
            <asp:PlaceHolder ID="emptyWindow" runat="server">
                <div id="empty">
                    <h2 class="gridTitle"><asp:Literal ID="Literal5" runat="server" Text="<%$Resources:NoCategories %>"></asp:Literal></h2>
                </div>
            </asp:PlaceHolder>
      
        </div>
        <div class="info" id="divFaq" runat="server">
            <div class="infoBottom">
                <h3>Category FAQs</h3>
                <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:GenericContentCategoriesFAQText %>"></asp:Literal>
                <p class="hideAllFAQs">
                    <a href="javascript:void(0)" onclick="javascript:Personalization.hideFaqSection('<%= divFaq.ClientID %>')">Hide FAQs everywhere</a>
                </p>
            </div>
        </div>
        <div class="clear"><!-- --></div>
    </div>


    Best wishes,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    20 Dec 2011
    Link to this post
    Thanks Boyan.

    I have another question about the search function for the custom module. On the front end page, I can programmatically filter the search result by categories (see following code snippet), but how can I filter the result by tags?
    List<Telerik.Cms.Engine.IMetaSearchInfo> filter = new List<Telerik.Cms.Engine.IMetaSearchInfo>();
     
    foreach (ListItem item in chklist_categories.Items)
    {
        if (item.Selected)
            filter.Add(new Telerik.Cms.Engine.MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, "Category", item.Value));
    }
     
    System.Collections.IList listOfContentItems = contentManagerPark.GetContent(filter.ToArray());

    Thanks,
    Stephen
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Dec 2011
    Link to this post
    Hi Stephen,

    Tags are not metafields, so you cannot use MetaSearchInfo filter. You can query the content list by using one of the GetContent overloads

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    21 Dec 2011
    Link to this post
    Thanks Ivan.

    Now I can filter the search result by categories and ONLY ONE tag. The program code is as following. But is there any way to filter the result by multiple tags? Like the following code, I tried to get the items which have tag CCCCC or DDDDD, but it seems like not possible. Thanks.

    Stephen
    IList listOfContentItems = null;
            ContentView nvCtrl = new ContentView();
            ContentFilterBuilder filterBuilder = new ContentFilterBuilder(nvCtrl);
            filterBuilder.AddFilter(new ContentFilterStatement("Category", "AAAAA", ContentFilter.Condition.Equal, ContentFilter.JoinType.And));
            filterBuilder.AddFilter(new ContentFilterStatement("Category", "BBBBB", ContentFilter.Condition.Equal, ContentFilter.JoinType.And));
            filterBuilder.AddFilter(new ContentFilterStatement("Tag.Name", "CCCCC", ContentFilter.Condition.Equal, ContentFilter.JoinType.Or));
            filterBuilder.AddFilter(new ContentFilterStatement("Tag.Name", "DDDDD", ContentFilter.Condition.Equal, ContentFilter.JoinType.Or));
     
                listOfContentItems = contentManagerPark.GetContent(0,
                                  int.MaxValue,
                                  nvCtrl.SortExpression,
                                  filterBuilder.ParseTagFilter(),
                                  ContentStatus.Published,
                                  null,
                                  filterBuilder.ParseParentsFilter(),
                                  filter.ToArray()
                                  );


  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Dec 2011
    Link to this post
    Hello,

    As you can see from the overloads you cannot pass more than one tag as a parameter. You can workaround this issue by making intersection.

    This feature is available out of the box in 4.x editions.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    22 Dec 2011
    Link to this post
    Can you explain a bit in detail how to make intersection? If you can provide some sample code about it, it would be much more helpful. Thanks Ivan. Stephen
Register for webinar
16 posts, 0 answered