onmenuitemclick Event is Not Firing in IE6 ASP.NET - asp.net

I had a asp.net Menu control on the master page and binded in the runtime based on the user access rights to the module. The problem I face is the MenuItemClick event is not fired when I view the website in the Internet Explorer(6.0). But the same is working fine in Firfox. I tried googling but none of the solutions worked for me. I was wondring if some one could help me to fix this.

There is no problem with Internet Explorer.
When you used MenuItem you probably used this form:
<asp:Menu ID="NavigationMenu" OnMenuItemClick="NavigationMenu_MenuItemClick" runat="server">
<items>
<asp:MenuItem Text="menuItem1" NavigateUrl="Web.aspx" />
<asp:MenuItem Text="menuItem2" NavigateUrl="otherWeb.aspx" />
</items>
</asp:Menu>
When you wrote in this form, the browser dosen't respect your event, because you gave it the URL to navigate to.
If you want that the browser will respect your event and handle it as well, you should delete the "NavigateUrl" attribute and it will work out.

Related

NavigateURL in MVC has extra domain

So I have an asp.net MenuItem user control created ( similar to what this post has ) within inside a MVC view. The user control works as expected, except the NavigateUrl.
This is the menuitem inside the usercontrol.
<asp:MenuItem Text="View Account" NavigateUrl="~/pages/account.aspx" />
The link looks fine if the user control is being rendered from a webform, it shows
http://localhost/SampleTest/pages/account.aspx
However, put the usercontrol inside the mvc view will have it rendered as
http://localhost/SampleTest/SampleTest/pages/account.aspx
There's an extra domain name "SampleTest" in the url.
What should I do to get rid of the extra domain name?
you need to update your URL navigation to URL.content.
<asp:MenuItem Text="View Account" NavigateUrl="#URL.content("~/pages/account.aspx")" />
code is not tested, but you can do like these.

My TabContainer which is a CustomControl in asp.net not working on IE-11

Below is the code for the same where I have set the default and selected style for the tab:
<cc1:AdvancedTabStrip id="subTs" AutoPostBack="True" runat="server"
TabDefaultStyle="background-color:#ffffff;font-family:arial;font-weight:bold;font-size:8pt;color:#000000;width:110;height:21;text-align:center;text-decoration:underline;border-color:#efefef;border-style:solid;border-width:1px;"
TabSelectedStyle="background-color:#ffffff;color:#000000;text-decoration:none;" >
<cc1:AdvancedTabItem ID="tabGeneral" Text="General" ControlToShow="pnlGeneral"></cc1:AdvancedTabItem>
<cc1:AdvancedTabItem ID="tabOpenPeriods" Text="Open Periods" ControlToShow="pnlOpenPeriods"></cc1:AdvancedTabItem>
<cc1:AdvancedTabItem ID="tabAdvanced" Text="Advanced" ControlToShow="pnlAdvanced"></cc1:AdvancedTabItem>
</cc1:AdvancedTabStrip>
The above code for styling works perfect in other browsers except IE-11
Can anyone please provide solution for the same asap as our customer are chasing for this very badly.

ASP.Net MenuItem in Chrome

My ASP.Net Menu & associated MenuItems are not rendering correctly in Chrome. That is to say, they are all rendering simultaneously, in sequential order down the page, rather than as drop-down menus.
They work normally when I run the page from the solution (including in Chrome), but when I deploy it to the test server, the nested nature of the menus are lost. In my example, "Admin Maintenance," "Grid Maintenance," "Today Screen" and "Setup should all be items under the "Admin" menu, and the last 3 should be items under "Setup." They are setup correctly and, as mentioned before, they work fine when run from within VS.
A screenshot:
My code:
<asp:Menu ID="Menu1" runat="server" CssClass="menu"
EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal" StaticDisplayLevels="1">
<Items>
<asp:MenuItem Text="PTS Home" Value="PTS Main" NavigateUrl="Default.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Admin" Value="Admin">
<asp:MenuItem Text="Admin Maintenance" Value="Admin_Admin Maintenance" NavigateUrl="~/Secure/Admin/AdminMaintenance.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Grid Maintenance" Value="Admin_Grid Maintenance" NavigateUrl="~/Secure/Admin/GridMaintenance.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Today Screen" Value="Admin_Today Screen" NavigateUrl="~/Secure/Admin/TodayScreen.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Setup" Value="Admin_Setup">
<asp:MenuItem Text="Reserve Owner Codes" Value="Admin_Setup_Reserve Owner Codes"
NavigateUrl="~/Secure/Admin/MaintainOwnerCodes.aspx"></asp:MenuItem>
<asp:MenuItem Text="Reserve Product Codes" Value="Admin_Setup_Reserve Product Codes"
NavigateUrl="~/Secure/Admin/MaintainProductCodes.aspx"></asp:MenuItem>
<asp:MenuItem Text="Enter New Grade" Value="Admin_Setup_Enter New Grade" NavigateUrl="~/Secure/Admin/MaintainGrades.aspx">
</asp:MenuItem>
</asp:MenuItem>
</asp:MenuItem>
... //Other items
</Items>
</Menu>
The weirdest/most annoying thing is that on the production server, when I first load the page, it does this, but I leave & come back, it fixes itself. On the test server, it just stays broken.
Also, this behavior occurs in IE 8, as well, though I suspect that that's a red herring, and none of my users use IE 8, anyway.
I've included the IIS keyword, as I have a feeling that this is more a server issue than a code issue, but I'm not certain. I'm not certain which version of Windows Server/IIS we run, & our server admin is out at the moment. I'll update the question later when I have that info, but I was hoping that there might be an answer anyway.
UPDATE
Windows Server 2008 R2 SP1, IIS7.
Figured out what was going on. Came upon it somewhat by accident.
The page uses mixed content (the menu itself being unsecure content). Chrome automatically blocks unsecure content on mixed pages, displaying a shield in the address bar. Click the shield, tell it to load unsecure content, and bam - no more weird behavior.
http://knowledgebase.pearsonschool.com/kmp/article/AA-05523/0/GPOINT%3A-How-do-I-display-mixed-content-with-Google-Chrome.html
Of course, I should probably just fix the menu to be secure, but this at least tells me what was going on, and may help others with similar problems.

ASP:MENU On click open submenu

I have the following ASP:Menu
<asp:Menu id="menu_mymenu" runat="server" OnMenuItemClick="menu_mymenu_Click">
<Items>
<asp:MenuItem Text="menu_1" Value ="menu_1">
<asp:MenuItem Text="menu_a" Value="menu_a" />
<asp:MenuItem Text="menu_b" Value="menu_b"/>
</asp:MenuItem>
</Items>
</asp:Menu>
On mouse over it displays submenus menu_a and menu_b. I would like the onclick on menu_1 to display the submenus menu_a and menu_b in the same way without posting back. Is there anyway to do this?
It looks like this is not something that is particularly easy to do and may be a bit hacky. I've seen a lot of suggestions of trying to use a treeview instead of the menu control. Anyway here are some resources I found and a solution that appears may do the trick:
http://forums.asp.net/t/1250342.aspx
Is it possible to force a menu popout to trigger on click instead of mouseover?
If it is absolutely necessary to have this be on click then it would be worth looking into a solution that fits your needs. In this case I would recommend looking into a treeview or looking at a purely css / javascript solution.
Hopefully this gets you down the right path!
I have customized as per the requirement; below is the link for complete solution.
https://stackoverflow.com/a/60986351/3099784

ASP.NET Postback Crashes IE

I have a very simple ASP.NET 3.5 SP1 application, which has a postback trigger onchange for a checkbox (autopostback=true). For some reason, in all versions of IE when I click that checkbox the broswer crashes.
<asp:CheckBox ID="ckTrouble" runat="server" Text="Check this box" TextAlign="Left" AutoPostBack="True" />
The checkbox is in a user control, which sits on a normal old page, which uses a traditional masterpage. This works fine in Firefox and Chrome, only IE is causing the grief.
Thoughts?
It seems that this may have been a result of SmartNavigation="True". Anyone ever see this as a cause? See this.

Resources