如何在后面的代码中添加两个以上的菜单项. [英] How to add more than two menu items in the codebehind.

查看:51
本文介绍了如何在后面的代码中添加两个以上的菜单项.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何在后面的代码中添加两个以上的菜单项.

因为,添加两个以上菜单项时出现错误..

看看我的代码.
------------

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.
------------

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...?

推荐答案

这意味着"Adm"代表的索引不在Rdr集合.
It means that the index represented by "Adm" isn''t in the Rdr collection.


这篇关于如何在后面的代码中添加两个以上的菜单项.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆