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

RadSiteMap and Dynamic RadMenu

6 Answers 215 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 22 Jul 2013, 12:54 PM
Hi, I have a web page that inside it has a user control where I put RadSiteMap. This user control charge inside another user control that has a radmenu dynamically loaded from sqldatasource.
In the page load event of the user control where I put RadSiteMap I included this
         Try
             Dim UC_text As UserControl = DirectCast (Me.FindControl ("MenuOr1"), UserControl)
             Dim RMenu As RadMenu = CType (UC_text.FindControl ("RadMenu1"), RadMenu)
             Dim CurrentItem As RadMenuItem = RMenu.FindItemByUrl (Request.Url.PathAndQuery)
             If CurrentItem IsNot Nothing Then
                 'Select the current item and his parents
                 currentItem.HighlightPath ()
                 'Update the title of the
                 PageTitleLiteral.Text = currentItem.Text
                 'Populate the breadcrumb
                 DataBindBreadCrumbSiteMap (CurrentItem)
             else
                 RMenu.Items (0). HighlightPath ()
             end If

         Catch ex As Exception

         end Try

As this function Dim CurrentItem RadMenuItem = RMenu.FindItemByUrl (Request.Url.PathAndQuery)

no value.
Can you help?
thanks
Salve!-interiezione
Hello!
Salve!, Ciao!, Pronto?, Pronto!, Piacere!
Hi!
Ciao!, Salve!, Piacere!
Hail!
Salve!, Salute!
Cheers!
Evviva!, Salve!, Cincin!
Hallo!
Ciao!, Salve!, Pronto!
Would you mind answering some questions to help improve translation quality?
Trascina e rilascia il file o il link qui per tradurre il documento o la pagina web.
Trascina e rilascia il link qui per tradurre la pagina web.
Il tipo di file che rilasci non è supportato. Prova altri tipi di file.
Il tipo di link che rilasci non è supportato. Prova altri tipi di link.

6 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 25 Jul 2013, 01:19 PM
Hello,

Could you please try to use the following code implementation in order to return the RadMenuItem instead of null.
//markup code
<telerik:RadMenu ID="RadMenu1" runat="server">
    <Items>
        <telerik:RadMenuItem Text="Item1" NavigateUrl="http://localhost:50920/Menu/SamplePage.aspx?Item1"></telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Item2" NavigateUrl="http://localhost:50920/Menu/SamplePage.aspx?Item2"></telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Item3" NavigateUrl="http://localhost:50920/Menu/SamplePage.aspx?Item3"></telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>

//code behind
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        Try
            Dim UC_text As UserControl = DirectCast(Me.FindControl("MenuOr1"), UserControl)
            Dim RMenu As RadMenu = CType(UC_text.FindControl("RadMenu1"), RadMenu)
            Dim CurrentItem As RadMenuItem = RMenu.FindItemByUrl(Request.Url.ToString())
            If CurrentItem IsNot Nothing Then
                'Select the current item and his parents
                CurrentItem.HighlightPath()
                'Update the title of the
                PageTitleLiteral.Text = CurrentItem.Text
                'Populate the breadcrumb
                DataBindBreadCrumbSiteMap(CurrentItem)
            Else
                RMenu.Items(0).HighlightPath()
            End If
 
        Catch ex As Exception
 
        End Try
    End Sub

I would like to clarify that the navigate URL host "localhost" is set for sample purposes. 

Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Michele
Top achievements
Rank 2
answered on 25 Jul 2013, 02:39 PM
thanks I solved the problem by calling the databind the menu before calling the function in question
0
Michele
Top achievements
Rank 2
answered on 25 Jul 2013, 02:45 PM
I have another problem, I would like to change the font color dynamically:

<telerik:RadSiteMap ID="BreadCrumbSiteMap" runat="server" DataTextField="Text"

DataNavigateUrlField="NavigateUrl">

<DefaultLevelSettings ListLayout-RepeatDirection="Horizontal" SeparatorText="/" Layout="Flow" />

</telerik:RadSiteMap

 

 

 

 

 

>

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

     BreadCrumbSiteMap.Style.Add("color", "#000000")
End Sub

 not  Work
how can I do?
0
Michele
Top achievements
Rank 2
answered on 29 Jul 2013, 01:15 PM
no solution?
0
Michele
Top achievements
Rank 2
answered on 29 Jul 2013, 01:34 PM
how do I convert this post to a ticket
thanks
Michele
0
Boyan Dimitrov
Telerik team
answered on 30 Jul 2013, 08:55 AM
Hello,

I would like to clarify that Kate have already answered to "change the font color dynamically" question in the support thread with id 720859 and form thread with id 720851. Please review the answers and continue the communication in the aforementioned threads.
I would like to note that in order to avoid any further confusions please use the RadMenu forum section for questions and issues regarding RadMenu control.

Thank you for understanding.

Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Menu
Asked by
Michele
Top achievements
Rank 2
Answers by
Boyan Dimitrov
Telerik team
Michele
Top achievements
Rank 2
Share this question
or