This is a migrated thread and some comments may be shown as answers.

Unable to set RadMenu Target

2 Answers 96 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 2
Randy asked on 14 Dec 2009, 05:45 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 14 Dec 2009, 04:21 PM
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! :)
0
Randy
Top achievements
Rank 2
answered on 14 Dec 2009, 07:21 PM

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.

Tags
Menu
Asked by
Randy
Top achievements
Rank 2
Answers by
Schlurk
Top achievements
Rank 2
Randy
Top achievements
Rank 2
Share this question
or