MenuAdapter VS DropDownList

Last post 06-14-2006 4:13 PM by Russ Helfand. 9 replies.

Sort Posts:

  • MenuAdapter VS DropDownList

    05-10-2006, 11:32 PM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    Hi there..

    Does anyone having trouble using MenuAdapter and DropDownList?
    My problem is that the dropdownlist overlapped the menu.

    Regards
    f3661

  • Re: MenuAdapter VS DropDownList

    05-12-2006, 11:03 AM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    Hi again...

    No answer eh... :P

  • Re: MenuAdapter VS DropDownList

    05-12-2006, 12:48 PM
    • Contributor
      3,300 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 742

    Maybe I can help... but you'd have to post some sample files or code.  Is it possible to construct a simple ASPX page that demonstrates the problem/conflict you are seeing?

    Russ Helfand
    Groovybits.com
  • Re: MenuAdapter VS DropDownList

    05-12-2006, 3:43 PM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    Hi, first of all thanx :)

    These are taken from the Menu.aspx from the sample plus added the dropdownlist

    ...
     <div id="Sample-Content">
    <asp:dropdownlist id="DropDownList" runat="server">
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
    </asp:dropdownlist>

    Lorem ipsum dolor sit amet
    ...

    When running the modified sample try to place your cursor above the product menu, you'll see that the dropdownlist is covering the sub-menu.

    Regards

  • Re: MenuAdapter VS DropDownList

    05-14-2006, 5:47 AM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    Btw, this behavior doesn't occurs when using firefox.

    So nobody Internet Explorer anymore eh... Smile [:)]


  • Re: MenuAdapter VS DropDownList

    05-14-2006, 10:42 AM
    • Contributor
      3,300 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 742

    Thanks for the extra info about FF.  Looking into this whole issue is on my radar for this coming week.  I appreciate your patience.

    Russ Helfand
    Groovybits.com
  • Re: MenuAdapter VS DropDownList

    05-14-2006, 1:08 PM
    • Contributor
      3,300 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 742

    OK, curiousity got the better of me, despite it being Sunday. :)

    It turns out that this is a well-known issue with IE:

    http://www.webreference.com/programming/javascript/form/

    It may be fixed for IE7; I don't know; it would be interesting if someone on the forums could test it in IE7 beta2.

    Meanwhile, we can work around the issue.  Let's try to create/refine a solution together (everyone reading this forum).  Here's what I would suggest initially:

    In MenuExample.css (or whatever CSS file you are using to adjust the appearance of your menu) add a class like this:

    .AspNet-Menu-NoDisplay

    {visibility: hidden;}

    Then use the following enhanced version of JavaScript\MenuAdapter.js:

    var hoverClass = "AspNet-Menu-Hover";
    var topmostClass = "AspNet-Menu";
    var noDisplayClass = "AspNet-Menu-NoDisplay";
    var arrayFormTagNames = new Array("INPUT", "SELECT", "OPTION", "BUTTON", "TEXTAREA");
    
    function ShowHide_FormElements__AspNetMenu(showIt)
    {
        var iTagName, tagName, iFormElement, formElement;
        
        for (iTagName=0; iTagName<arrayFormTagNames.length; iTagName++)
        {
            tagName = arrayFormTagNames[iTagName];
            var arrayFormElements = document.body.getElementsByTagName(tagName);
            for (iFormElement=0; iFormElement<arrayFormElements.length; iFormElement++)
            {
                formElement = arrayFormElements[iFormElement];
                if (showIt)
                {
                    RemoveClass__CssFriendlyAdapters(formElement, noDisplayClass);
                }
                else
                {
                    AddClass__CssFriendlyAdapters(formElement, noDisplayClass);
                }                
            }
        }
    }
    
    function Hover__AspNetMenu(element)
    {
    //    AddClassUpward__CssFriendlyAdapters(element.firstChild /* gets the inner SPAN or A */, topmostClass, hoverClass);
        AddClass__CssFriendlyAdapters(element, hoverClass);
        ShowHide_FormElements__AspNetMenu(false);
    }
    
    function Unhover__AspNetMenu(element)
    {
    //    RemoveClassUpward__CssFriendlyAdapters(element.firstChild /* gets the inner SPAN or A */, topmostClass, hoverClass);
        RemoveClass__CssFriendlyAdapters(element, hoverClass);
        ShowHide_FormElements__AspNetMenu(true);
    }
    
    function SetHover__AspNetMenu()
    {
        var menus = document.getElementsByTagName("ul");
        for (var i=0; i<menus.length; i++)
        {
            if(menus[i].className == topmostClass)
            {
                var items = menus[i].getElementsByTagName("li");
                for (var k=0; k<items.length; k++)
                {
                    items[k].onmouseover = function() { Hover__AspNetMenu(this); }
                    items[k].onmouseout = function() { Unhover__AspNetMenu(this); }
                }
            }
        }
    }
    
    window.onload = SetHover__AspNetMenu;
    
    

    This should result in form items appearing/disappearing so they don't interfere with the menu.  You may decide that this is too distracting.  You could, of course, limit which form elements are impacted by tweaking the JavaScript so it doesn't consider all form elements in the body but, instead, some more limited subset of form elements that are causing you grief... though I'm not sure how you might do that without injecting a bunch of very site-specific code into the JavaScript.

    What are your thoughts?

    Russ Helfand
    Groovybits.com
  • Re: MenuAdapter VS DropDownList

    05-14-2006, 7:02 PM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    OMG, you're good...

    I'll try this one but there are some sugesting to use combination <iframe> with the <div> I don't know how exactly it works and to implement it in the css adapter 'cause I'm a newbie Stick out tongue [:P].

    Thanx
  • Re: MenuAdapter VS DropDownList

    05-16-2006, 1:17 AM
    • Member
      50 point Member
    • f3661
    • Member since 05-11-2006, 3:26 AM
    • Posts 12
    I've tried yours, it's working and good but somehow it's kinda strange looking the controls become invisible and visible again. But again it's working and good.

    Thanx.

  • Re: MenuAdapter VS DropDownList

    06-14-2006, 4:13 PM
    • Contributor
      3,300 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 742

    A somewhat more acceptable solution is now being proposed on this later thread, http://forums.asp.net/1314890/ShowThread.aspx#1314890.  Please continue this discussion there. Thanks.

    Russ Helfand
    Groovybits.com
Page 1 of 1 (10 items)