Category Archives: Menu

[RESOLVED] Dynamic Menu items

Does anyone know how to set a selected asp.net dynamic menu item to false?  I have multiple menus and when someone selects an item from one of the dropdown menus it changes color.  If I were to select an item from a different menu I need the other menus not to have the selected option anymore.

You have to save Selected Menu Item ValuePath and access the item with that path to clear selection

public string SelectedMenuPath
{
    get
    {
        return Convert.ToString(ViewState["SelectedMenuPath"]);
    }
    set
    {
        ViewState["SelectedMenuPath"] = value;
    }
}

Create a property like that and save the selected path in Menu ItemClick event

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
    //save selected path
    SelectedMenuPath = e.Item.ValuePath;
}

You can clear selection in any other event as

if (!string.IsNullOrEmpty(SelectedMenuPath))
    Menu1.FindItem(SelectedMenuPath).Selected = false;

Selected Dynamic Menu item

I am trying to set the background color of a selected item in a dynamic dropdown menu.  I have a 10px horizontal padding on for the dropdown menu.  Some of the options in the menu are longer in word length.  I want to set the background color of a selected item across the entire width of the dropdown including the padding.  I have also tried setting padding in my css style sheet left and right but it doesn't give the desired effect because of the longer worded menu items.  At the moment I am only able to set the background color of the word itself in the dropdown menu.  On selected item the horizontal-padding goes back to 0 to incorporate the css padding.  I know this isn't the final solution but the issue still remains.  Any ideas?

Style sheet

.menubk TD /* Defines the entire menu background table */
{
  background-color:#2A2B64;
}
.menudynbkfor a /* Defines the top menu color and 'a' to override link default*/
{
  background-color:#2A2B64;
  color:#FFFFCC;
}
.menudynbk_select a /* Defines the dynamic selected item of menu color and 'a' to override link default*/
{
  background-color:#FFFFCC;
  color:#2A2B64;
  padding-left:10px;
  padding-right:10px;
}
.menudynbk TD /* Defines the dynamic dropdown menu color and 'TD' to override inherited table*/
{
  background-color:#2A2B64;
}


VB.Net Code

<asp:Menu ID="mnu" runat="server" CssClass="menudynbkfor"
                       DynamicEnableDefaultPopOutImage="False" DynamicHorizontalOffset="33" 
                        Orientation="Horizontal" StaticMenuItemStyle-HorizontalPadding="25" StaticEnableDefaultPopOutImage="False"
                        style="font-family: Arial, Helvetica, sans-serif">
                        <DynamicMenuItemStyle CssClass="menudynbkfor" HorizontalPadding="10px" ItemSpacing="5px" />
                        <DynamicMenuStyle CssClass="menudynbk" />
                        <DynamicSelectedStyle CssClass="menudynbk_select" HorizontalPadding="0px" />
                        <Items>
                            <asp:MenuItem Text="Publication" Value="Publication" Selectable="False">
                            <asp:MenuItem Text="Operational" Value="Operational"></asp:MenuItem>
                            <asp:MenuItem Text="System" Value="System"></asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Rules" Value="Rules" Selectable="False">
                                <asp:MenuItem Text="Operational" Value="Operational" 
                                    ></asp:MenuItem>
                                <asp:MenuItem Text="Interface" Value="Interface"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Interfaces" Value="Interfaces" Selectable="False">
                                <asp:MenuItem Text="System" Value="0"></asp:MenuItem>
                                <asp:MenuItem Text="System Pairs" Value="1"></asp:MenuItem>
                                <asp:MenuItem Text="Messages / Templates" Value="2">
                                </asp:MenuItem>
                                <asp:MenuItem Text="Elements" Value="3"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services" Selectable="False">
                            <asp:MenuItem Text="Providers" Value="Providers"></asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Data Dictionary" Value="Data Dictionary"></asp:MenuItem>
                            <asp:MenuItem Text="Glossary" Value="Glossary" Selectable="False">
                                <asp:MenuItem Text="Acronyms" Value="Acronyms" ></asp:MenuItem>
                                <asp:MenuItem Text="Terminology" Value="Terminology"></asp:MenuItem>
                            </asp:MenuItem>
                        </Items>
                    </asp:Menu>


 

Blank ASPX page OR Page not being rendered

I have an application that was built on IBS V1, its worked well over the years.  It was previously done with NotePad, I'm now using VS 2005.

The problem I'm experiencing is that some ASPX pages are being rendered as blank.  When I view sourcecode in Notepad, all the HTML is there, but nothing is displayed and there is nothing to select.  If this was happening to all pages, I could solve it. It appears to be totally random. I have two pages which are identical except for the parameters, one is displayed okay, the other is just blank.

 This is happening when I view in Localhost in IE (tried 6 & 7 same results).

 When I was first working in VS2005 when I switched to design mode it was also blank, but this seemed to correct itself. None of the pages that are NOT being displayed is giving any problem or reporting any error in VS2005 and the same with Web Developer 2008.

 

 I would sujest you check your stylesheet or styles on the page incase you have display: none; or anything else like that set, best way to test is remove all style sheet reference.

 Possibly even copy the html from source view then remove styles and css file reference and test again as this eliminates serverside code.

What happens when debugging in VS? same thing?

Regards

Liam

Its not style sheets,  as I said I have two pages which are identical apart from a parameter, one page works and the other doesn't.

 It has something to do with the Page Compiler.

 But if the page is showing source code then it should be displayed...

Could you show the offending page code to try and replicate?

Regards

Liam

The problem has been identified. Its Internet Explorer.  All other browsers display the page.  IE previously had displayed the page, no it displays blank (but does serve up the code) so its IE.

This has happened to a number of pages, and the pages worked up until something makes IE not render the page.

 IE was the last thing I suspected, I've spent over 70 hours on this problem.

I've done some more testing, and Firefox and Safari both work flawlessly with the pages, that IE draws blank.  Opera doesn't work either, but Opera doesn't render the menus either, which all other three browsers do.  Opera has worked fine on my DNN sites, but it hates this site which was built on IBS SDK ASP.NET Framework V1.1.

 I like both Firfox and Safari, but for the last 6 years we have been telling everyone that our site only supports IE. We are looking very foolish.

there is no doubt i can fix your issue if you give me some code....  Without code and without knowing exactly what you are dealing with we are all just tossing random guesses at what the heck might be going on.....  I was one of the rebels when it came to upgrading to VS2005, I was upgrading everything my company ever wrote to VS2005 when the first beta came out...  So let me tell you i have seen my share of issues with code that should have worked out of the box....  If you post some code or im me I'm sure we can fix ur issue i a lot less hours than u've already spent.....

Its not VS. This site was built using IBS SDK, which means it has full source code .aspx pages which are compiled as accessed. There are DLL Classes which handle data, they all work fine. They are linked via Framework V1.1 with the vbc compiler. And since the pages are rendered correctly in FireFox and Safari without ANY problems. It cannot be an Error.

You are right, there has to be something that is happening as I edit the pages but what, I'm only making changes to pages or controls. None of the Controls have been rendered blank. So it has to be something in the ASPX page that IE doesn't like.  Two of the pages which are giving me the same problem are totally different. Both worked until there was a change, the change has not caused any errors (I use VS 2005 as my editor, it has no problems on either of these pages. If I deliberetly create errors, it finds them. So the page gets compiled properly.  It has to be something in the way IIS serves up the page, that only IE doesn't like.

See IE Newsgroup for more info.  I tried loading the code from right click view source, AFTER I saved it to a file.  When I load the file into Firefox, it displays. When I load thge file into IE it displays nothing. So this is a PURE Internet Explorer issue.

The problem is the following;

 in the following;

 <head>
    <title title="Edit Capital Income" />
    <link rel="stylesheet" href="../Portal.css" type="text/css" />
</head>

If I remove the following line, it all works.

    <title title="Edit Capital Income" />

 NOW the pages that work ALSO have the title, which was insisted by VS and IE did not object.


 

 

 Its more interesting as;

    <title title="Pupil Teacher Ratios - Primary"></title>

The above will work, but the following doesn't

 <title title="Edit Capital Income" />

 WHO IS RESPONSIBLE FOR THIS?

 

 Wow that's an interesting one! I knew it wasn't serverside but i would never have removed the title!

 

Liam

The reason I started this thread was I couldn't find any other Posts on this problem.  I just tried again, no luck finding this Thread using Search.  I tried the exact search for "rendered as blank"  having copied it from my original post. It found two pages of Posts, but not this thread.

It was suggested in the IE newsgroup, that IE behaved properly (in that it had a problem with the way the tag was written, the person suggested that there is only one way to write a title trag and that is <title></title>.  If that is the case then VS-2005 needs to reflect this.  It appears a bit strange that VS and IE use a different set of rules to interpret HTML.

i had a similar issue, where the designer wasn't rendering the UI, although there was plenty of html etc. I removed the style tag in the <head> tag and voila, the UI shows up. 

I stumbled on this thread with the exact same problem with <TITLE/>. Appreciate finding this. FYI, I've found opening and closing an IFRAME in a single tag also causes major problems, iirc, elements open and closed with a single tag have also caused the web postback method to be "not found". As a rule, all elements I create an open tag and close tag for, even if empty.

[RESOLVED] How can I use the timer event to let an en event such as the window.onresize only run for 12 a second and then stop

My Javascript swaps out links in the head tag that control such things as which direction a menu pops out depending on where it is on the screen.  Unfortunately, because it changes the position of panels when it changes the links, it puts window.onresize into an endless loop.

I would like to just set the function to run for 1 millisecon everytime it runs and then top. 

How can I do that?

Ehm considering you hav no code here or anything but if you want to use the timer control you can look here

http://msdn.microsoft.com/en-us/library/bb386404.aspx

but I dont know if that answers want you want...if you post you code it might be easier to help you :)

[RESOLVED] Menu Selected Item Background Color

Does anyone know how to change the background color of a selected menu item?  The background color changes on the word of the dropdown menu but not the entire row section of the menu item.  Each menu item has a different word length but I want the background color length to be consistent throughout the dropdown dynamic menu.  I also what to change the background parent when a menu item is selected. 

ok first to get the parent to change color when a child is selected you have to write a special control for that or some kind of helper class but to get the entire item to change background color you use

<asp:menu>

<StaticSelectedStyle BackColor="color of choise" />

<StaticSelectedStyle BackColor="color of choise" />

</asp:menu>

if you use the css it usually just changes the background on the text.