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

value returning null on client-side

1 Answer 41 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 15 Jan 2013, 02:15 PM
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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 18 Jan 2013, 01:42 PM
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.
Tags
Menu
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or