value returning null on client-side

2 posts, 1 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 15 Jan 2013 Link to this post

    Hello,

    I am programmably creating the menu.  I am creating it like this:

    Dim menuItem = New RadMenuItem(siteMapItem.Text, siteMapItem.Value)
    If (siteMapItem.Route IsNot Nothing) Then
    menuItem.NavigateUrl = "~/" + siteMapItem.Route.Uri
    End If

    Menu1.Items.Add(menuItem)

    However, on the client, the value is always null when I do:

    var items = menu.get_allItems();

    for (var i = 0, len = items.length; i < len; i++) {
    var item = items[i];
    var val = item.get_value(); //always null
    .
    .
    }

    Why is that?
  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 18 Jan 2013 Link to this post

    Hello Brian,

    Thank you for contacting Telerik Support.

    Please keep in mind that the RadMenuItem constructor that you are using takes as second parameter navigateUrl, not value. If you want to set a value to the newly created RadMenuItem I would suggest you to use the following approach:
    //code behind
    Dim menuItem As New RadMenuItem() With { _
        .Text = siteMapItem.Text, _
        .Value = siteMapItem.Value _
    }


    Kind regards,
    Boyan Dimitrov
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top