PC Review


Reply
Thread Tools Rate Thread

child menus orientation

 
 
thersitz
Guest
Posts: n/a
 
      26th Jan 2007
Hi,

with the asp menu control -- is it possible to make the child menu
orientation horizontal?

I am trying to duplicate what is happening on this page:

http://archives.drexelmed.edu/womanmd/home.php

under the title menu item -- where it displays: A | B | C ... ect.

thanks


 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmFzb24gVmVybWlsbGlvbg==?=
Guest
Posts: n/a
 
      27th Jan 2007
thersitz,

Unfortunately it is not possible to set the Orientation of a child MenuItem.
You can simulate the menu from the site that you mentioned by injecting html
into the Text property of a MenuItem.

See the attached example for details. The following page should be named
Menus.aspx

Jason Vermillion

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack){
PopulateMenu();
}
}

private void PopulateMenu()
{
MenuItem mnu;
MenuItem childmnu;
char curchar;
System.Text.StringBuilder sb;
string baseurl = @"<a
href=""Menus.aspx?search_in={0}&search_by={1}"">{1}&nbsp;</a>";
string search_in = "";
string html = "";
string tmp = "";
string[] aryMenues = { "TITLE", "DATE", "FORMAT", "SUBJECT", "NAME" };

mnuNav.Items.Clear();

foreach (string item in aryMenues)
{
mnu = new MenuItem(item, item);
mnu.Selectable = false;

if (item == "TITLE" || item == "NAME")
{
// get the search_in query string
search_in = (item == "TITLE") ? "title" : "name";
// Generate some links from A-Z
sb = new System.Text.StringBuilder(1024);
for (int i = 65; i <= 90; i++)
{
curchar = (char)i;
// Append the next letter in the alphabet(<a
href="...">A</a>)
sb.AppendFormat(baseurl, search_in, curchar.ToString());
}
html = sb.ToString();

childmnu = new MenuItem(html, "A-Z");
mnu.ChildItems.Add(childmnu);
}
else if (item == "DATE")
{
int delta = 3;
for (int i = 0; i < 10; i++)
{
tmp = string.Format("{0}-{1}", 2010 - (i + 1) * delta +
1, 2010 - i * delta);
childmnu = new MenuItem(tmp, tmp);
mnu.ChildItems.Add(childmnu);
}
}
else if (item == "FORMAT")
{
mnu.ChildItems.Add(new MenuItem("Book", "BOOK"));
mnu.ChildItems.Add(new MenuItem("E-Book", "E-BOOK"));
mnu.ChildItems.Add(new MenuItem("Dvd", "DVD"));
mnu.ChildItems.Add(new MenuItem("Audio", "AUDIO"));
}
else if (item == "SUBJECT")
{
mnu.ChildItems.Add(new MenuItem("Elephants", "Elephants"));
mnu.ChildItems.Add(new MenuItem("Fish", "Fish"));
mnu.ChildItems.Add(new MenuItem("Ants", "Ants"));
mnu.ChildItems.Add(new MenuItem("Jello", "Jello"));
}
mnuNav.Items.Add(mnu);
}

}

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Menu Test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="mnuNav" runat="server" Orientation="Horizontal">
</asp:Menu>
</div>
</form>
</body>
</html>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Child Windows cannot have menus error Keith G Hicks Microsoft Windows 2000 0 7th Jun 2005 03:12 PM
MDI Child forms and menus...best practice? Bob Rundle Microsoft Dot NET Framework Forms 6 23rd Aug 2004 06:16 PM
Child menus, how would I do this M Microsoft Dot NET Framework 2 10th Jul 2004 02:52 PM
Child Menus, what would the best way to do this M Microsoft Dot NET Framework Forms 0 9th Jul 2004 09:18 PM
Menus Items in Child Forms dont appear =?Utf-8?B?RGF2aWQgU3Rld2FydC1UaG9tc29u?= Microsoft Dot NET Framework Forms 0 8th Mar 2004 11:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:54 PM.