创建动态 html 菜单 Web 部件
我想在 Visual Studio 2010/2008 环境中使用微软提供的 sharepoitn 扩展创建 webpart。我有一个集合,就像
Home |As Parent |
Management|As Parent |
SubHome1 | As Child | Child of Home
SubHome2 | As Child | Child of Home
Download |As Parent |
我想一项一项地迭代一样。说这是数据表。如果在父项中列出项目,则需要动态添加菜单项,如果它是子项,则需要将其作为子菜单项添加到相应的菜单项中。我想用 c# 编写代码。我知道只有我们可以使用 HTMLGenericControl 类在 C# 中创建 html 控件。如何实现这一目标?请指导。
I want to create the webpart in Visual studio 2010/2008 environment with microsoft given sharepoitn extensions. I have collection like
Home |As Parent |
Management|As Parent |
SubHome1 | As Child | Child of Home
SubHome2 | As Child | Child of Home
Download |As Parent |
I want to iterate one by one item. say this is datatable. if Lits item in Parent then need to dynamically add Menu item , if it is child , then want to add as sub menu item to respective menu item. I want to write code in c#. I know only we can create the html control in c# using HTMLGenericControl class. how to achieve this ? please guide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用用户控件并将数据绑定到用户控件。在用户控件中,您可以读取数据源并构建菜单所需的 javascript/html。您可以使用 JQuery 构建导航菜单。 JQuery 中有太多可用的菜单插件。
http://designm.ag/resources/jquery-navigation-plugins/
You can use a user control and bind the data to the user control. In the user control you can read the datasource and build the javascript/html required for the menu. You can use JQuery to build the navigation menu. There are too many menu plugins available in JQuery.
http://designm.ag/resources/jquery-navigation-plugins/