Wrox Programmer Forums
|
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
 
Old November 12th, 2011, 09:24 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default can't review the replies to my last post

i posted a question about my advertisement banners missing and why my treeview control was not placed in the grey section of the drakgrey theme. the advertisement banners went missing after i completed chapter 11 (j query) by the way i cannot seem to review the response to my last thread
 
Old November 12th, 2011, 09:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can find the thread here: wrox advertisement banners are missing

To resolve the Tree issue, please post the markup and code behind of the Master page as well as the code for the BasePage.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 12th, 2011, 10:37 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default master page and basepage code

basepage

Imports Microsoft.VisualBasic

Public Class Basepage
Inherits System.Web.UI.Page

Private Sub Page_PreRender(
ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

If Me.Title = "Untitled Page" Or String.IsNullOrEmpty(Me.Title) Then
Throw New Exception(
"Page title cannot be ""Untitled Page""or an empty string.")

End If
End Sub
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.PreInit
Dim preferredTheme As HttpCookie = Request.Cookies.Get("PreferredTheme")
If preferredTheme IsNot Nothing Then
Page.Theme = preferredTheme.Value
End If

End Sub

End Class

MASTER PAGE

Master Language="VB" CodeFile="Frontend.master.vb" Inherits="Styles_MasterPages_Frontend" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.4.1.min.js" />
</Scripts>
</asp:ScriptManager>
<div id="PageWrapper">
<div id="Header">
<br />
<a href="~/" runat="server"></a></div>
<div id="MenuWrapper"></div>
<div id="MainContent">
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath><br />

<asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />


<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />
</LevelStyles>
</asp:TreeView>


<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
</asp:ContentPlaceHolder>


</div>
<div id="Sidebar">Select a Theme of your choice<br />
<asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True">
<asp:ListItem>Monochrome</asp:ListItem>
<asp:ListItem>Darkgrey</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Vertical" />
<br />
</div>
<div id="Footer">Footer Goes Here</div>
</div>
<asp:ContentPlaceHolder ID="cpClientScript" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
</html>

MASTER PAGE CODE BEHIND VB

Partial Class Styles_MasterPages_Frontend
Inherits System.Web.UI.MasterPage


Protected Sub ThemeList_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ThemeList.SelectedIndexChanged
Dim preferredTheme As HttpCookie = New HttpCookie("PreferredTheme")
preferredTheme.Expires = DateAndTime.Now.AddMonths(3)
preferredTheme.Value = ThemeList.SelectedValue
Response.Cookies.Add(preferredTheme)
Response.Redirect(Request.Url.ToString())
End Sub

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim selectedTheme As String = Page.Theme
Dim preferredTheme As HttpCookie = Request.Cookies.Get("PreferredTheme")
If preferredTheme IsNot Nothing Then
selectedTheme = preferredTheme.Value
End If
If Not String.IsNullOrEmpty(selectedTheme) AndAlso
ThemeList.Items.FindByValue(selectedTheme) IsNot Nothing Then
ThemeList.Items.FindByValue(selectedTheme).Selecte d = True
End If
End If
Select Case Page.Theme.ToLower()
Case "darkgrey"
Menu1.Visible = False
TreeView1.Visible = True
Case Else
Menu1.Visible = True
TreeView1.Visible = False

End Select
End Sub
End Class
 
Old November 12th, 2011, 10:39 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default previous thread that i could not view

im sorry what i meant about the previous thread that i could not view. i can locate the previous thread however when i try to open it, it opens to a blank page for some reason
 
Old November 12th, 2011, 11:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Looks OK at first sight. What exactly is the problem? Is the tree not visible at all, or in the wrong location?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 12th, 2011, 11:51 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Oh, I think I see it. Take a look at this:

<div id="MenuWrapper"></div>
<div id="MainContent">

Your MenuWrapper is empty and your navigation controls are in the MainContent. It should be like this instead:

Code:
<div id="MenuWrapper">
  <asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False">
  </asp:Menu>
  <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ShowExpandCollapse="False">
 <LevelStyles>
   <asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />
 </LevelStyles>
  </asp:TreeView>
  <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
</div>
<div id="MainContent">
  <asp:SiteMapPath ID="SiteMapPath1" runat="server">
  </asp:SiteMapPath>
  <br />
  <br />
  <asp:ContentPlaceHolder ID="cpMainContent" runat="server">
  </asp:ContentPlaceHolder>
</div>
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 12th, 2011, 01:35 PM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default darkgrey theme is back to normal

thanks for the code, my darkgrey theme is back to normal now, however in the monochrome theme, my menu bar has gone back to being a grey colour, it was previously a purple colour, how do i change the colour of the menu bar in the monochrome theme, and my wrox banners are still not showing up when i open the website on the internet, please could you be of some assitance, thanks
 
Old November 12th, 2011, 09:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you describe the problem in more detail? Or maybe upload a screen shot somewhere?

Also, take a look at the official Planet Wrox website at http://aspnet4.planetwrox.com/ Does your look like that?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Very slow and almost no replies...BAD..!!! zach007 Forum and Wrox.com Feedback 4 December 23rd, 2006 06:48 PM
Replies to the Forum brucen BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 2 November 12th, 2005 06:54 AM
Thank you for all replies flyfish Access 0 February 4th, 2005 08:11 PM
I cannot read my post/replies siawash Linux 2 January 26th, 2004 05:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.