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

Forums / 3.x Pre-release forums (retired) / ItemCreated Event of Menu control not fired

ItemCreated Event of Menu control not fired

10 posts, 0 answered
  1. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    03 May 2007
    Link to this post
    Hello

    I have a website with a developed menu custom control that worked perfectly in RC1. In this menu control the menu items are based on images that are created automatically. This images are created in the Menu_ItemCreated event.

    This user control is used in the master page. So for every page the menu is build up again
    After converting the website to RC2, this menu control is acting different:
    When I open a page that should be shown in the navigation (so property Show in navigation is true), the menu_itemcreated is firred for every menu item and everything works fine.

    However when I open a page that should not be shown in the navigation, the menu_itemcreated is not firred anymore, so nothing is shown in the menu.

    This worked fine in RC1. Could you tell me what has been changed?
    What do I need to change in the menu control?

    Regards
    Luc
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    07 May 2007
    Link to this post
    Hello Luc,

    We made improvements on the CmsSiteMapProvider overriding some of methods of the base StaticSiteMapProvider. Also, we added the functionality to check the view permissions if the anonymous access for the page is denied. But we didn't intend to change its existing behavior. Maybe this problem is related to these changes.
    Could you please send us your existing menu control? We will test it locally and will let you know how to proceed.

    Sorry for the inconvenience.

    All the best,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    07 May 2007
    Link to this post
    Hello Vlad

    It is not that easy to send you the menu control because it is related to an image control that does generate images based on the menu text.
    This generation of image is defined in the menu_itemcreated event.

    But I think you can test the problem very easy by yourself by placing a standard menu control on the masterpage and implement the menu_temcreated event.

    When you define a page that has the property 'Show in navigation' set to false, the menu_itemcreated event is not fired. In RC1 this event was fired for every page independent of the status of this property 'Show in navigation'

    When it is still a problem for you to reproduce the problem I will send you our menu control with the image contrtol as well.

    Regards
    Luc
  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    07 May 2007
    Link to this post
    Hello Luc,

    I think I understand the problem now. Perhaps it is related to the navigable attribute in the CmsSiteMapProvider in the web.config, if it is set to False, the SiteMapProvider contains all pages, otherwise it contains only navigable pages, the default is True:

    <siteMap defaultProvider="CmsSiteMapProvider" enabled="true">
        <
    providers>
            <
    clear/>
            <
    add name="CmsSiteMapProvider" 
                
    type="Telerik.Cms.Web.CmsSiteMapProvider"
                description="Displays Cms Pages"
                navigable="false"
     
    />
        </
    providers>
    </
    siteMap>

    I suppose that in the RC1 project you have used CmsSiteMapProvider with navigable="false" for the menu control. Please set it to false again and let us know how it goes.


    Regards,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    07 May 2007
    Link to this post
    Hello Vlad

    This is not an option. Because of setting navigable=false all pages are shown in the menu, independent of the setting of property 'Show in navigation'.

    Also for those pages where the property 'Show in navigation' is set to no, the menu is shown but not with the correct menu items. In that case only the pages with 'Show in navigation' is set to no are shown in the menu.

    Regards
    Luc
  6. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    08 May 2007
    Link to this post
    Hello Luc,

    It seems I cannot quite understand the problem again.
    Generally, here is the behavior of the CmsSiteMapProvider (it is not changed in Sitefinity RC2 compared to RC1):
    If navigable=false, the SiteMapProvider contains all pages no matter if they are set as 'Show in navigation' or not, otherwise the SiteMapProvider contains only pages with 'Show in navigation'. The RadMenu ItemCreated event is fired only for items which are stored in the SiteMapProvider, and there is no chance for it  to be different. We tested the RadMenu ItemCreated event as you described and didn't notice any unexpected behavior.
    Please let us know if we are missing something.

    I think it would be better if you send us the menu control with a description of how it should behave.


    Regards,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    08 May 2007
    Link to this post
    Hello Vlad

    I stripped my mainmenu component so far that it contains only very basic information (information that is not relevant for the problem is removed)

    This menu control is added to the master page so that it is shown at every page that is created.

    The problem that occurs in RC2: for every page that has set the property 'Show in navigation' to Yes, the menu is shown correctly.
    But for every page that has set the property 'Show in navigation' to No, the menu is not shown at all.

    I didn't have this problem in RC1.


    MainMenu.ascx:

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="MainMenu.ascx.vb" Inherits="UserControls_MainMenu" %>
    <%
    @ Register Assembly="RadMenu.Net2" Namespace="Telerik.WebControls" TagPrefix="radM" %>
    <radM:RadMenu ID="uxMainMenu" style="z-index: 10000;" runat="server" DataSourceID="SiteMapDataSource1" Skin="Default" SkinsPath="~/Skins/Menu"></radM:RadMenu>
    <
    asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server" />

    MainMenu.ascx.vb:

    Partial Class UserControls_MainMenu
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            
    'Set starting node for navigation based on language
            
    SiteMapDataSource1.StartingNodeUrl = "/cms_milestrebv/nederlands.aspx"
        
    End If
    End Sub

    Protected Sub uxMainMenu_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.RadMenuEventArgs) Handles uxMainMenu.ItemCreated

        If Not Page.IsPostBack Then
            
    If e.Item.Level = 0 Then
                
    e.Item.Text = e.Item.Text + "*"
                
    e.Item.GroupSettings.OffsetX = -3
                e.Item.GroupSettings.OffsetY = 3
            
    Else
                
    e.Item.GroupSettings.OffsetY = -1
            
    End If

            e.Item.NavigateUrl = e.Item.ResolveUrl(e.Item.NavigateUrl)

        End If

    End Sub

    End Class


    When you look at website http://www.milestre.nl (it is still RC1 implementation) and select the page 'Why a cms' (the property 'Show in navigation' for this page is set to no) you see that the menu is still shown.
    In the website that is converted to RC2 (on our development server) the menu is not shown at all for this page.

    I hope I explained the problem good enough to reproduce the problem.

    Regards
    Luc

  8. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    09 May 2007
    Link to this post
    Hello Luc,

    We saw your site http://www.milestre.nl and we understand the problem: when you go to 'Why a cms' page and it's property 'Show in navigation' is set to false, the top menu for this page is not shown, right?
    But seems this problem could not be related to the menu or the CmsSiteMapProvider, as we thought previously. Also  we cannot reproduce the same behavior. your project together with the database.


    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    09 May 2007
    Link to this post
    Hello Vlad

    I found the cause of the problem.
    I have developed another site that uses the MainMenu control in almost the same way. That site is also converted to RC2 but has no problem at all with showing the menu for pages with 'Show in navigation' is set to No.

    So I investigated both sites for the specific differences. The problem is caused by the explicit definition of SiteMapDataSource1.StartingNodeUrl = "/cms_milestrebv/nederlands.aspx" in the MainMenu control.

    When I remove this declaration everything is working fine.
    I don't have a solution yet.

    Regards
    Luc
  10. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    11 May 2007
    Link to this post
    Hi Luc,

    We found the problem with the SiteMapDataSource.StartingNodeUrl property. It is related to some of our modifications in the CmsSiteMapProvider.FindSiteMapNode() method,  sometimes it cannot find the requested url (especially when the requested url is not the current one).
    We fixed this issue, so your menu control implementation with SiteMapDataSource1.StartingNodeUrl should work fine in the official release next week. We are sorry for the inconvenience and thank you for your patience about this problem.

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
10 posts, 0 answered