473,408 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

child menus orientation

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
Jan 26 '07 #1
1 2091
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>

Jan 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nancy Shelley | last post by:
Hi all: I am building a navigation menu using telerik's rad treeview I am able to build the outer menu but not the children. How do I select the child nodes (item) from within the loop? Any...
6
by: Tom | last post by:
Rather than merge child menus, I would like for some common functionality between various MDI child forms to process an event fired from the main menu, depending on who is in focus. Is this...
2
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I made menus using Javascript code when I tried to attach these menus to my ASP.Net code it didn`t work!! then I`ve downloaded user control from the internet creates menus, it worked...
2
by: Jim H | last post by:
I would like to have some MenuItems that are specific to my child form appear in the main menu. In the MSDN documentation: Menu merging is typically done to merge the menus of a Multiple...
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
0
by: ILCSP | last post by:
Hello, I have a VB.Net project where I have created a dynamic menu. This menu has 2 parents (File and Edit) and I need to place 3 child submenus under Edit at runtime. The problem is that I am...
23
by: LvBohemian | last post by:
I am playing around with creating some menus dynamically, and they create fine and show up ok when I want them to; but when I select a menu NavigateUrl at run time, the applicable url shows up...
0
by: Med | last post by:
Hi, How can I fire click event for menus child items? My menu is located in a WebUserControl as follow: <asp:Menu ID="mnuMain" runat="server" OnMenuItemClick="Menu1_MenuItemClick"...
7
by: phpnewbie26 | last post by:
Hi! I'm new to PHP and I have a question about generating parent-child drop down menus. I have seen many forums on how to generate them from databases, but not many from arrays. Let's say the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.