Working with Menu Control in

In this article we will discuss about the binding of menu control to a XML file. We will also see the way of creating tabs in without using the ajaxtoolkit. We will create it with the help of Menu and the multiview control available in the visualstudio tool.

First we will see creating a tab control with the help of menu and multiview control.
For this we will take a menu control and a multiview control. Multiview control will show the
content of the selected tab and menu control will display tabs.

take the controls like this:

Selected="true" />
Value="2" />

<asp:View ID="view1" runat="server">
To pave way for a safer and better tommorrow. Safer, by bringing blood donors and those in need to a common platform.
Better, by giving a child what he/she deserves the most, best education. In next 5 years, we aim to be the real hope of every
Indian in search of a blood donor, who believes in humanity.
<asp:View ID="view2" runat="server">
To make the best use of contemporary technologies in delivering a promising web portal to bring together all the blood donors in India;
thereby fulfilling every blood request in the country.
To provide a common platform for those who have a zeal to support rural child education.
<asp:View ID="view3" runat="server">
DignityExcellenceDiversityIndividual and team workCompassionAdvanceTrustIntegrityOblige

and now in the codebehind on menu control event we will write below code:

protected void menu1_MenuItemClick(object sender, MenuEventArgs e)
MVSolutions.ActiveViewIndex = Int32.Parse(menu1.SelectedValue);

For binding the menu control with an xml file we first create an xML file.
Suppose we create it like:

<?xml version="1.0" encoding="utf-8" ?>
<BookType text="Technology">
<Book text="C++" author="Yashwant Kanetkar" />
<Book text="C#" author="Yashwant Kanetkar" />
<BookType text="Recipe">
<Book text="Vegetarian" author="Sanjeev Kapoor" />
<Book text="NonVegetarian" author="Sanjeev Kapoor" />
<BookType text="Children">
<Book text="Maths" author="subhash" />
<Book text="Rhymes" author="kesar" />

and now we will bind this xml file with menu control with the help of xmldatasource:

<asp:Menu ID="Menu1" DataSourceID="cmlbooks" runat="server">
<asp:MenuItemBinding DataMember="BookType" TextField="text" />
<asp:MenuItemBinding DataMember="Book" TextField="text" ValueField="author" />
<asp:XmlDataSource ID="xmlbooks" DataFile="Books.xml" runat="server" />


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: