CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/6/2006 4:13:44 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 13 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
adbspam
Asp.Net User
Setting Menu Static and Dynamic Menus to be the same width12/6/2006 4:13:44 PM

0/0

I am using a menu control with an xml sitemap.  I have one level of static menu items shown and I'm setting their width to be 100% so that the menu takes up the entire width of the screen and is evenly divided into 3 separate menu items no matter what resolution the screen is out or if it is resized.

 However, on the dynamic dropdown menus that come from the static menus, I am trying to make them set to be the same width as the parent static menu.  Is this possible? I try 100% on the dynamicmenu and dynamicmenuitem styles but that is only doing 100% of however long the text is.

I do not want to specifically set the width of the items to an actual pixel width.

Any ideas?

Thanks

adbspam
Asp.Net User
Re: Setting Menu Static and Dynamic Menus to be the same width12/7/2006 5:03:16 PM

0/0

For Anyone that is interested, I got this working using javascript.

   

 protected void Page_Load(object sender, EventArgs e)
        {            

            EnableMenuWidthMatching(divisionMenu);

        }

        private void EnableMenuWidthMatching(Menu menu)
        {
            string jsFunc = @"function setSubMenuWidth(elem)       
            {        
                var i;        
                       
                //The menu gives TD items the ID in the form MenuNamenX 
                //where MenuName is the UniqueID of the menu control given in code, and X is the number of the menu assigned
                if (elem.id != null && elem.tagName == 'TD')
                {
                    //If you find a TD element with n, then...            
                    var idIndex = elem.id.lastIndexOf('n');
                    if (idIndex > -1)
                    {
                       //Try to see if you can find a div with the same name but Items appended              
                        var menuItems = document.getElementById(elem.id + 'Items');
                       //If you find it, that is the dropdown menus, set the width to the same
                        if (menuItems != null)
                            setAllChildWidths(menuItems, elem.offsetWidth);
                        
                    }
                    
                }
                 //Recurse down through every child node
                 for (i = 0; i < elem.childNodes.length; i++)
                        setSubMenuWidth(elem.childNodes[i]);        
                         
            }     
                   
            function setAllChildWidths(baseElement, itemWidth)
            {    
                //Set the current element width
                if (baseElement.style != null)
                    baseElement.style.width = itemWidth;
                //Loop through each child node
                for (i = 0; i < baseElement.childNodes.length; i++)
                {
                    //for some reason it would get stuck on elements with #text, so skip them
                    if (baseElement.childNodes[i].nodeName != '#text')
                        setAllChildWidths(baseElement.childNodes[i], itemWidth);
                }
                
            }   
            ";
            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "menuWidthSetting", jsFunc, true);
            
            string jsOffset = "setSubMenuWidth(document.getElementById('" + menu.ClientID + "'));";
            if (string.IsNullOrEmpty(menu.Attributes["onmouseover"]))
                menu.Attributes["onmouseover"] = jsOffset;
            else
                menu.Attributes["onmouseover"] += ";" + jsOffset;
        }
 

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Adobe Flash CS3 Professional Bible Authors: Robert Reinhardt, Snow Dowd, Pages: 1232, Published: 2007
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Macromedia Flash MX 2004 Bible Authors: Robert Reinhardt, Snow Dowd, Pages: 1250, Published: 2004
Flash MX Bible Authors: Robert Reinhardt, Snow Dowd, Pages: 1270, Published: 2002
CHI '92 Conference Proceedings: ACM Conference on Human Factors in Computing Systems : Striking a Balance, May 3-7, 1992, Monterey, California Authors: Penny Bauersfeld, John Bennett, Gene Lynch, SIGCHI (Group : U.S.), Pages: 713, Published: 1992
Flash 8 Cookbook Authors: Joey Lott, Jeffrey Bardzell, Pages: 510, Published: 2006
PHP Solutions: Dynamic Web Design Made Easy: Dynamic Web Design Made Easy Authors: David Powers, Pages: 468, Published: 2006
AutoCAD 2008: One Step at a Time Authors: Timothy Sean Sykes, Pages: 700, Published: 2007

Web:
Setting Menu Static and Dynamic Menus to be the same width - ASP ... However, on the dynamic dropdown menus that come from the static menus, I am trying to make them set to be the same width as the parent static menu. ...
Setting Menu Static and Dynamic Menus to be the same width - ASP ... Setting Menu Static and Dynamic Menus to be the same width. Last post 12-07-2006 12:03 PM by adbspam. 1 replies. Sort Posts: ...
Dynamic Drive DHTML Scripts- Static Menu Script Static menu script (By maXimus, [email protected], http://maximus.ravecore.com /) Modified slightly/ permission granted to Dynamic Drive to feature script ...
Relative positioning with dynamic (ASP) menu Last point: One of your initial ideas was to make the overall width of the menu static, but then you found that the menu's width setting is ...
Using CSS and Styles with the Menu Control If you want all static menu items to look the same and all dynamic menu items to ... The width of the control is set by the Width Menu control property. ...
How Can Set The Style In Dynamic Webpart How Can Set The Style In Dynamic Webpart. Create professional DHTML and JavaScript Menus ... Fit to large - to make all the menu buttons have the same size. ...
DHTML Lab: Dynamic HTML Tutorials, DHTML Scripts, Programming ... Need to set your menu font size differently depending on the user's browser? ..... [17] Dynamic Synchronized Frames NN4 IE4+ Frames as static navigational ...
Using List/Menu form elements Static List Values with the Dynamic Dropdowns Extension ... This is done so that your list or menu will have a set width at all times. ...
Building a Dynamic WordPress Nav Menu - Beast-Blog.com Feb 8, 2007 ... This is the code for the dynamic menu produced by the WordPress core. ... modify the script part of this menu if you had a static home page. ...
Software Download: Dynamic Menu Supports autowidth function to set the size just fit menu items new! ..... types (static and dynamic site map tree, DHTML / Javascript drop down menu, ...




Search This Site:










dnn and .text

create user wizard

insert query

role based forms authentication

the toolbox items i need are dimmed, in visual web dev 2008. why?

debug is painfully slow

ibuyspy spec

split navigation on same deapth

vwd express and silverlight

authentication problem on iis and asp.net 2.0

server.transfer / response.redirect & forms authentication

modules displaying on all tabs

installing vs 2008 beta 2 - how?

masterpage errors

host dnn smtp settings for multiple portal.

multipage - pageview and tabstrip question !!

content management.

on galary module error

user controls and code behind

error when installing survey module...

url autorization and classic asp

how to retrieve network userid? c#

treeview control - windows 98

how do you find my new website done with dotnetnuke

whidbey: tired with sessions? - use the new profile property to store user information

custom profile providers integrated with createuserwizard

2.0 application under a 1.1 root

how not to install dnn 3.0.10

how to creat new page ,database and conection in clubstarterkit?

applying styles to contentplaceholder context

 
All Times Are GMT