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

RadMenuItem set to different pages

3 Answers 177 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 06 Sep 2019, 03:32 PM

I have a radmenu and one of the radmenuitems needs to be set to differernt pages depending on session variable.  The other menuitems are static. 

I have tried navigateurl='<%# session("pageid")%>

The first menuitem is the one I want to be dynamic

 

here is my radmenu code

 <telerik:RadMenu runat="server" ID="radMenu2" Style="vertical-align:middle; width: 74%; margin: 0 auto;padding-right:5px; padding-bottom: 15px; padding-top: 10px;"  RenderMode="Lightweight"  >
                  <Items>
                      <telerik:RadMenuItem runat="server" Text="Letter of Intent/Proposal" Font-Names="Trebuchet MS" Font-Size="12pt" navigateurl='<%#Session("pageName") %>'></telerik:RadMenuItem>
                      <telerik:Radmenuitem text ="Letter of Intent/Proposal"  font-size="12pt" Font-Names="Trebuchet MS" runat="server"
           enabled="true" >
                </telerik:Radmenuitem>
          <telerik:Radmenuitem text ="Third Party Information" font-size="12pt" Font-Names="Trebuchet MS" runat="server"
           >
                </telerik:Radmenuitem>
                   <telerik:radmenuitem text="Essentials" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/essentialinfo.aspx"></telerik:radmenuitem>
                 
                <telerik:radmenuitem text="Focus" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/focus.aspx"></telerik:radmenuitem>
              
                <telerik:radmenuitem text="Award Design" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/awardDesign.aspx"></telerik:radmenuitem>
               <telerik:radmenuitem text="Student Support" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/studentsupport.aspx"></telerik:radmenuitem>

                <telerik:radmenuitem text="Narrative" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/Narrative.aspx"></telerik:radmenuitem>
                
                <telerik:radmenuitem text="Invoice Schedule" runat="server" font-size="12pt" Font-Names="Trebuchet MS"  navigateurl="/mssApplications/invoiceSchedule.aspx"></telerik:radmenuitem>
                
                <telerik:radmenuitem text="Grant Documents" runat="server" font-size="12pt" Font-Names="Trebuchet MS" navigateurl="/mssApplications/grantdocuments.aspx"></telerik:radmenuitem>
                </items>
                </telerik:radmenu>

 

Thank you

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Sep 2019, 11:19 AM
Hello Robin,

This syntax is a databinding-expression and it will work only when the RadMenu is bound, for instance:
protected void Page_Load(object sender, EventArgs e)
{
    radMenu2.DataBind();
}

Alternatively, you can traverse the existing RadMenu items in the PreRender event and change the NavigateUrl programmatically. The traversing can happen either by using the radMenu2.Items collection or FindItemByText or FindItemByValue.

That should resolve the issue. Feel free to give it a try and let me know about the result. 

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Robin
Top achievements
Rank 1
answered on 09 Oct 2019, 08:40 PM

Ok,  i added the radmenu1.databind to my page load

code

   Protected Sub Page_Load(sender As Object, e As EventArgs)
     
        Dim appid = Session("appid")
 
        Dim apptypeid = Session("apptypeid")
   
        radMenu1.DataBind()

        If Session("usertype") = 1 Then
            Session("pageid") = "admin/viewapps.aspx?type=1"
        Else
            Session("pageid") = "dashboard/mainpage.aspx"
        End If

    End Sub

 

in my radmenu I put

     <telerik:RadMenuItem Text="Existing Applications" Font-Size="12pt" Font-Names="Trebuchet MS" runat="server"
                    navigateurl='<%# session("pageid") %>'>
                </telerik:RadMenuItem>

 

clicking the menu item doesnt call anything

0
Eyup
Telerik team
answered on 10 Oct 2019, 07:47 AM

Hello Robin,

 

In this case, could you prepare a very basic runnable sample to demonstrate this issue and open a formal support ticket to send it to us? This will enable us to further investigate the issue locally and provide more accurate and precise solutions.

 

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Menu
Asked by
Robin
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Robin
Top achievements
Rank 1
Share this question
or