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

RadMenu Being Dynamically Created: Troubles in Paradise

1 Answer 68 Views
Menu
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 19 Aug 2011, 03:09 PM
Hi Guys,

I'm experiencing a strange glitch in the process of creating a dynamic RadMenu. What I'm trying to accomplish is to create a menu using 2 sql statements. The first one will create the root layer, and the second one will create the children. Here is the code that I use for the root layer which is working correctly:

 

 

Dim item1 As New RadMenuItem()

 

item1.Text = DataReader(

 

"menu_name").ToString.Trim()

 

item1.Font.Bold =

 

True

 

item1.Width = 185


Here is the code for the children, which I'm looping through the second datareader:

 

 

Dim item11 As New RadMenuItem()

 

item11.Text = DataReaderB(

 

"page_name").ToString.Trim()

 

item11.NavigateUrl =

 

"InteriorPages.aspx?ID=" & DataReaderB("id")

 

item1.Items.Add(item11)

RadMenu1.Items.Add(item1)


For the most part, this is working correctly... Except one of the six menu items that I'm testing doesn't show its children. Now it has the arrow on the right hand side of the root level and while stepping through the code it should be adding several children and there are no errors. Its the same item each time.

What can I be doing so wrong that would cause this to happen?

Any help would be greatly appreciated.

William

1 Answer, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 19 Aug 2011, 03:42 PM
I figured this out... :)  After adding each child, I was using this code:

 

 

Dim item11 As New RadMenuItem()

 

item11.Text = DataReaderB(

 

"page_name").ToString.Trim()

 

item11.NavigateUrl =

 

"InteriorPages.aspx?ID=" & DataReaderB("id")

 

item1.Items.Add(item11)

RadMenu1.Items.Add(item1)

I had to remove the RadMenu1.Items.Add(item1) out of the loop that gathered the children, then only issue this once per menu root item, after the child items have been gathered.

Hope this helps someone!

Tags
Menu
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Share this question
or