Unable to set RadMenu Target

3 posts, 1 answers
  1. Randy
    Randy avatar
    3 posts
    Member since:
    May 2008

    Posted 13 Dec 2009 Link to this post

    For some reason I am unable to properly set the Target for my RadMenu items.
    I'm using v 3.1208.35

    I was expecting the NavigateUrl's to load in the RadPanel 'cPane', but instead it loads in a new window.
    The following code is not working like I expected/hoped it would.

    Any help would be appreciated ... please.
    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" Height="100%">  
        <telerik:RadPane ID="topPane" runat="server" Height="54px">  
            <div class="header" style="background-image: url('images/HeaderBlueBG.png');">  
                <div class="logo" style="width:100%;background-image: url('images/HeaderBlue.png');" > 
                </div> 
            </div> 
            <telerik:RadMenu runat="Server" ID="RadMenu1" Style="float: none; position:absolute; top:28px; z-index:3000" Width="100%">  
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Administration">  
                        <Items> 
                            <telerik:RadMenuItem runat="server" Text="User Manager" NavigateUrl="~/Admin/Users.aspx" Target="cPane" /> 
                            <telerik:RadMenuItem runat="server" Text="Employee Manager" NavigateUrl="~/Admin/Employees.aspx" Target="cPane" /> 
                        </Items> 
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem runat="server" Text="Candidates">  
                        <Items> 
                            <telerik:RadMenuItem  runat="server" Text="My Candidates" NavigateUrl="~/Candidate/cList.aspx" Target="cPane"  /> 
                            <telerik:RadMenuItem runat="server" Text="Hiring Managers" NavigateUrl="~/Candidate/HiringMangers.aspx" Target="cPane" /> 
                        </Items> 
                    </telerik:RadMenuItem> 
                </Items> 
            </telerik:RadMenu> 
        </telerik:RadPane> 
    <telerik:RadSplitBar runat="server" /> 
        <telerik:RadPane runat="server" ID="cPane" Scrolling="none"></telerik:RadPane> 
    </telerik:RadSplitter> 
     
  2. Answer
    Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 14 Dec 2009 Link to this post

    I believe since the RadPane basically creates a IFrame there might be an issue with the RadMenu getting a reference to the content place holder of the RadPane come rendering time (they probably get rendered pretty closely to each other). I did the following, using the target property in the code-behind, and it worked:

    ASPX:
    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" Height="100%">   
        <telerik:RadPane ID="topPane" runat="server" Height="54px">   
            <telerik:RadMenu runat="Server" ID="RadMenu1" Style="float: none; position:absolute; top:28px; z-index:3000" Width="100%">   
                <Items>  
                    <telerik:RadMenuItem runat="server" Text="Administration">   
                        <Items>  
                            <telerik:RadMenuItem runat="server" Text="User Manager" NavigateUrl="~/Test.aspx" />  
                            <telerik:RadMenuItem runat="server" Text="Employee Manager" NavigateUrl="~/Test.aspx"/>  
                        </Items>  
                    </telerik:RadMenuItem>  
                    <telerik:RadMenuItem runat="server" Text="Candidates">   
                        <Items>  
                            <telerik:RadMenuItem  runat="server" Text="My Candidates" NavigateUrl="~/Test.aspx"  />  
                            <telerik:RadMenuItem runat="server" Text="Hiring Managers" NavigateUrl="~/Test.aspx" />  
                        </Items>  
                    </telerik:RadMenuItem>  
                </Items>  
            </telerik:RadMenu>  
        </telerik:RadPane>  
    <telerik:RadSplitBar ID="RadSplitBar1" runat="server" />  
        <telerik:RadPane runat="server" ID="cPane" Scrolling="none" ContentUrl="about:blank"></telerik:RadPane>  
    </telerik:RadSplitter>  


    C#:
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                foreach(RadMenuItem myItem in RadMenu1.Items) 
                { 
                    assignTarget(myItem); 
                } 
            } 
        } 
        protected void assignTarget(RadMenuItem item) 
        { 
            item.Target = cPane.ClientID; 
            if (item.Items.Count != 0) 
            { 
                foreach (RadMenuItem myItem in item.Items) 
                { 
                    assignTarget(myItem); 
                } 
            } 
        } 

    Hopefully this helps! :)
  3. Randy
    Randy avatar
    3 posts
    Member since:
    May 2008

    Posted 14 Dec 2009 Link to this post

    Schlurk -

    You ROCK!

    Thank you for your help.

     

    I had tried the code-behind, but I only had it half right.  I was missing the nested items.

    Also, it seems the ContentUrl parameter is required as well.  Not until I added it as you did in the declaration did it work.

    Again, thank you for your help.

Back to Top