IT Community - Software Programming, Web Development and Technical Support

<asp:Menu> Control in Detail?

This is a discussion on <asp:Menu> Control in Detail? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi, Could any one explain <asp:Menu> control in detail.......


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-11-2008, 10:20 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile <asp:Menu> Control in Detail?

Hi,
Could any one explain <asp:Menu> control in detail....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-11-2008, 10:30 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: <asp:Menu> Control in Detail?

Hi,
I found that this control used for creating menus both horizontal and Vertical..
But My need is to use xmlDataSource and load the content of the node in 'Menu's Datasource.But here you can give only IHierarchial DataSource.Otherwise it shows error.So I gave xmlDataSourceId to DataSourceId of Menu.This is creating whole xml file as Menu.

Consider My sampleXMLFile(test.xml)

<ViewCategory>

<Category>
<Id>1</Id>
<Name>Test1</Name>
<SubName>subTest1</SubName>
</Category>
<Category>
<Id>2</Id>
<Name>Test2</Name>
<SubName>subTest1</SubName>
</Category>
<Category>
<Id>1</Id>
<Name>Test2</Name>
<SubName>subTest1</SubName>
</Category>
</ViewCategory>

From this I want Name to list as a SubMenu Vertically over 'Product.gif' image.How to load the particular node in Menu Control.
My aspx codings is below,

<asp : Menu Id="Menu1" runat="server" DataSourceId="xmlDataSource1"></asp:Menu>
<asp : xmlDataSource Id="xmlDataSource1" runat="server" DataFile="test.xml"/>

Last edited by poornima : 02-12-2008 at 06:30 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-13-2008, 04:04 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: <asp:Menu> Control in Detail?

Hai,
Its working.The thing you have to do is change the XML Format like this

<ViewCategory>
<Menu Id="21" MenuName="Test1">
<Category Id="2" CategoryName="Book" />
<Category Id="3" CategoryName="Computer" />
</Menu>
<Menu Id="22" MenuName="Test2">
<Category Id="4" CategoryName="Book"1 />
<Category Id="5" CategoryName="Computer1" />
</Menu>
</ViewCategory>

If you have xml Format like this,then it will work.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-21-2008, 01:02 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: <asp:Menu> Control in Detail?

Hi,
Use like this,DataBinding property is used to bind the submenus at runtime..
<asp : Menu Id="Menu1" runat="server" DataSourceId="xmlDataSource1">
<DataBindings>
<asp:MenuItemBinding DataMember="MenuMapping" TextField="MenuName" />
<asp:MenuItemBinding DataMember="Category" TextField="Name" />
</DataBindings>
</asp:Menu>
<asp : xmlDataSource Id="xmlDataSource1" runat="server" DataFile="test.xml"/>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-29-2008, 09:33 PM
GDevakii GDevakii is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 138
GDevakii is on a distinguished road
Smile Re: <asp:Menu> Control in Detail?

<?xml version="1.0" encoding="utf-8" ?>
<Home>
<Menu text="Books" url="MenuFromXml.aspx">
<SubMenu text="Asp.Net" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Ajax" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="MS SQL Server 2005" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="JavaScript" url="MenuFromXml.aspx"></SubMenu>
</Menu>
<Menu text="Electronics" url="MenuFromXml.aspx">
<SubMenu text="Camera" url="MenuFromXml.aspx">
<SubMenu text="Digital" url="MenuFromXml.aspx">
<SubMenu text="Canon" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Kodak" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Sony" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Casio" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Fuji" url="MenuFromXml.aspx"></SubMenu>
</SubMenu>
<SubMenu text="Film Camera" url="MenuFromXml.aspx"></SubMenu>
</SubMenu>
<SubMenu text="DVDs" url="MenuFromXml.aspx">
<SubMenu text="Comedy" url="MenuFromXml.aspx">
<SubMenu text="English" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="French" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="German" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Spanish" url="MenuFromXml.aspx"></SubMenu>
</SubMenu>
<SubMenu text="Kids Movies" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Romance Movies" url="MenuFromXml.aspx"></SubMenu>
<SubMenu text="Action Movies" url="MenuFromXml.aspx"></SubMenu>
</SubMenu>
</Menu>
<Menu text="Contact Us" url="MenuFromXml.aspx"></Menu>
</Home>

<asp:Menu ID="Menu1" runat="server" DataSourceID="XmlDataSource1"
MaximumDynamicDisplayLevels="4" StaticDisplayLevels="1"
DynamicHorizontalOffset="1" DynamicVerticalOffset="1">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#990000" Font-Bold="False"
ForeColor="White" />
<DynamicMenuStyle BackColor="#FFFBD6" />
<StaticSelectedStyle BackColor="#FFCC66" />
<DynamicSelectedStyle BackColor="#FFCC66" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DataBindings>
<asp:MenuItemBinding DataMember="Menu" TextField="text" ValueField="text"
NavigateUrlField="url" />
<asp:MenuItemBinding DataMember="SubMenu" NavigateUrlField="url" TextField="text"
ValueField="text" />
</DataBindings>
<StaticHoverStyle BackColor="#990000" Font-Bold="False" ForeColor="White" />
</asp:Menu>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/5236-asp-menu-control-detail.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 02-13-2008 04:18 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Populate menu using sitemap and asp .net menu control and c#: Archer C# Programming 3 04-29-2008 09:23 PM
Needs detail about XML? poornima ASP and ASP.NET Programming 8 03-17-2008 08:13 PM
Expalin the bugs in detail? devarajan.v Testing Tools 1 07-26-2007 11:37 PM
Please let me know the following topic's in detail? devarajan.v Software Testing 0 07-17-2007 11:30 PM
Vertical menu or horizontal menu? capture Web Design Help 1 03-12-2007 06:25 PM


All times are GMT -7. The time now is 02:37 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0