如何使用asp.net将项目绑定到菜单控件 [英] how to bind items into menu control using asp.net

查看:69
本文介绍了如何使用asp.net将项目绑定到菜单控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,



i希望通过从数据库中获取数据来显示项目进入menucontrol。

i创建了存储过程,我想要在菜单控件中绑定公司名称。
存储过程中的
我有一个表,我使用公司ID选择公司名称。在我的表中包含9个公司名称。



i想要这样显示...

ibm

infosys

tcs

techmahindra





...... ...像这样所有的公司名称都将在菜单项中显示....

i就像这样尝试....

< asp:menu id = menucomprunat =server>

< items>









i已绑定在.cs文件中,如

menucomp.datasource = fldjlfj.fdfjdjfl();

menucomp.databin();



它给出异常分层......出现错误







请尽快给我回答



感谢你。

解决方案

< blockquote>如果您收到以下错误:



HierarchicalDataBoundControl只接受实现IHierarchicalDataSource或IHierarchicalEnumerable的数据源。



然后按照以下步骤操作:



http://forums.asp.net/t/1308798.aspx?Menu+problems+HierarchicalDataBoundControl+error [ ^ ]


hi sir,

i want to show items into menucontrol by getting data from database.
i was created stored procedure and i want to bind company names in menu control.
in stored procedure i have one table in that i am selecting company names by using company id. in my table contain 9 company names.

i want to show like this...
ibm
infosys
tcs
techmahindra
.
.
.........like this all company names will be dispalyed in menu items....
i was tried like this....
<asp:menu id="menucomp" runat="server">
<items>




i have binded in .cs file like
menucomp.datasource=fldjlfj.fdfjdjfl();
menucomp.databin();

it giving exception hierachical....something error



please give me answer as early as possible

thanking you.

解决方案

If you get the following error:

HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable.

then follow the steps in :

http://forums.asp.net/t/1308798.aspx?Menu+problems+HierarchicalDataBoundControl+error[^]


这篇关于如何使用asp.net将项目绑定到菜单控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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