 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 29th, 2010, 06:52 AM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
Horizontal Menu made in asp.net 4 running on 3.5 server
Hi all,
Are there any differences in the menu code from 3.5 to 4? I have been working through the book and at the same time developing my own site. The menu I created works fine when debugged from my own machine but not when I ftp to a 3.5 site I have.
Any thoughts?
Regards
Lee
|

October 29th, 2010, 07:44 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Lee,
Yes, it's quite different. In .NET 3.5, a table based structure was used. In .NET 4, the menu is built with <ul> and <li> elements. You can tell .NET 4 to render the menu the way it did in 3.5, but not the other way around.
You can render as 3.5 in 4.0 by modifying the <pages /> element in web.config as follows:
Code:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
Hope this helps,
Imar
|

October 29th, 2010, 12:06 PM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Many thanks for your reply. I already have this piece of code in the web.config file. This is what I have:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
</configuration>
Regards
Lee Warren
|

October 29th, 2010, 12:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
And does it work now?
Imar
|

October 29th, 2010, 12:18 PM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
No - I had that line of code in from the beginning.
|

October 29th, 2010, 12:32 PM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
This is my code for the menu
<div id="Navigation">
<asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1"
Orientation="Horizontal" StaticSubMenuIndent=""
MaximumDynamicDisplayLevels="2" StaticEnableDefaultPopOutImage="False">
<DynamicHoverStyle BackColor="#FF9900" Font-Names="Verdana" Font-Size="16px"
Height="30px" CssClass="NavAlign" />
<DynamicMenuItemStyle Height="30px" CssClass="NavAlign" />
<DynamicMenuStyle Height="60px" HorizontalPadding="5px" />
<DynamicSelectedStyle Height="30px" />
<StaticHoverStyle BackColor="#FF9933" />
<StaticMenuItemStyle Font-Names="Verdana" Height="30px"
VerticalPadding="10px" />
<StaticMenuStyle BackColor="White" CssClass="MainMenu" Height="30px"
HorizontalPadding="1px" VerticalPadding="1px" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>
|

October 29th, 2010, 12:34 PM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
|

October 29th, 2010, 01:47 PM
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
|
|
Actually....
I have the start Options under the WebSite menu set to Target Framework 3.5
If I don't have this set like this, then the website when uploaded shows an error.
Is this complicating things and should I start again?
Regards
Lee
|

October 29th, 2010, 01:59 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
Is this complicating things and should I start again?
|
No, if your final server only has .NET 3.5, you *need* this setting in order to make the site run on .NET 3.5
With regard to the menu: check its final HTML and see if you can find a difference between the one that works and the one that doesn't.
Cheers,
Imar
|

October 29th, 2010, 02:02 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Just realized this may not be related to 3.5 versus 4, but about IE8 versus ASP.NET. Maybe this helps: IE8 and the Menu ?
Imar
|
|
 |
|