Click here to Skip to main content
15,901,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How to add more than two menu items in the codebehind.

Because, i am getting error when add more than two menu items..

see my code.
------------
VB
If Rdr("Home") = "Y" Then
                    mnuItems.NavigateUrl = "~\Home.aspx"
                    mnuItems.Text = "Home"
                    NavigationMenu.Items.Add(mnuItems)
                End If
                If Rdr("Adm") = "Y" Then
                    mnuItems.NavigateUrl = "~\Adm.aspx"
                    mnuItems.Text = "Adm"
                    NavigationMenu.Items.Add(mnuItems)
                End If


Here, when i add second item i am getting error.
Error in second add menuitems:
 "Index must be within the bounds of the List.
Parameter name: index"


please. help.

I am trying last three hours to solve this problem. but, i am not able to track what is the problem...?
Posted
Updated 2-Aug-11 2:31am
v2

1 solution

It means that the index represented by "Adm" isn't in the Rdr collection.
 
Share this answer
 
Comments
gani7787 2-Aug-11 8:16am    
Value will be there...
Then what else...?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900