Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2012, 03:59 PM
Authorized User
Points: 92, Level: 1
Points: 92, Level: 1 Points: 92, Level: 1 Points: 92, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Location: Pakistan
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default Master Page

Master Page

Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPage_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>
    <link href="../Styles/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
  <div id="PageWrapper">
    <div id="Header"><a href = "~/" runat="server">Header goes here</a></div>
    <div id="MenuWrapper">Menu Goes Here</div>
   <div id="MainContent">
    <asp:ContentPlaceHolder ID="cpMainContent" runat="server">
    </asp:ContentPlaceHolder>
    <div id="Sidebar">Sidebar Goes Here</div>
    <div id="Footer">Footer Goes Here</div>
  </div>
  </form>
</body>
</html>
Css file
Code:
#Header
{
  background-color: #C0C0C0;
  width: 844px;
  height: 86px;
}

*
{
  font-family: Arial;
}

h1
{
  font-size: 20px;
}

.Introduction
{
  font-style: italic;
  color: #003399;
}

#PageWrapper
{
  width: 844px;
}

#MenuWrapper
{
  width: 844px;
}

#MainContent
{
  width: 664px;
  float: left;
}

#Sidebar
{
  background-color: Gray;
  width: 180px;
  float: left;
}

#Footer
{
  background-color: #C0C0C0;
  width: 844px;
  clear: both;
}

#MainContent a
{
  color: #008000;
  text-decoration: underline;
}

#MainContent a:visited
{
  color: #FF0000;
  text-decoration: underline;
}

#MainContent a:hover
{
  color: #FFA500;
  text-decoration: underline;
}

h1
{
  padding: 0px;
  margin: 0px 0px 10px 0px;
}
Sir this is the code of my css file and master page.Now please tell me why my sidebar does not aligned on right and it comes above the footer?

Thanks
Reply With Quote
  #2 (permalink)  
Old April 21st, 2012, 04:22 PM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Your MainContent div is missing its closing </div> tag.

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!
Reply With Quote
  #3 (permalink)  
Old May 14th, 2012, 05:50 PM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Location: Upstate NY
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Almost the same problem

My MainContent has the closing div. My sidebar behaves the same as the origional poster's in design view, but displays correctly when i view it in the browser. Any idea why? thanks!
Reply With Quote
  #4 (permalink)  
Old May 15th, 2012, 02:24 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Can you post the code for the master page? Also, is your CSS file stored in the correct folder and does it contain the proper CSS code?

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!
Reply With Quote
  #5 (permalink)  
Old May 15th, 2012, 09:20 AM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Location: Upstate NY
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

The Style sheet is in the Styles filder. I believe the page is finding it, as the formatting is applied in the browser and (for the most part) in design view.

thanks. s.

Code:
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="../Styles/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <div id="PageWrapper">
            <div id="Header"><a href="~/" runat="server">Header goes Here</a>="</div>
            <div id="MenuWrapper">Menu Goes Here</div>
            <div id="Maincontent">
                <asp:ContentPlaceHolder id="cpMainContent" runat="server">
                </asp:ContentPlaceHolder>
            </div>
            <div id="Sidebar">Sidebar Goes Here</div>
            <div id="footer">Footer Goes Here</div>
        </div>
    </form>
</body>
Code:
#Header
{
    background-color: #C0C0C0;
    width: 844px;
    height: 86px;
}

*
{
    font-family: Arial;
}

h1
{
    font-size: 20px;
}

.Introduction
{
    font-style: italic;
    color: #003399;
}

#PageWrapper
{
    width: 844px;
}

#MenuWrapper
{
    width: 844px;
}


#MainContent
{
    width: 664px;
    float: Left;
}

#Sidebar
{
    background-color: #808080;
    width: 180px;
    float: Left;
}

#Footer
{
    background-color: #C0C0C0;
    width: 844px;
    clear: both;
}

#MainContent a
{
    color: #008000;
    text-decoration: underline;
}

#MainContent a:visited
{
    color: #FF0000;
    text-decoration: underline;
}
#MainContent a:hover
{
    color: #FFA500;
    text-decoration: underline;
}

h1
{
    margin: 0px 0px 10px 0px;
    padding: 0px;
}
Reply With Quote
  #6 (permalink)  
Old May 15th, 2012, 10:04 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

When I run your code, the page doesn't look in Design View nor in the browser. Which browser did you test this on? I had to make the following changes to the master page:

1. Change Maincontent to MainContent (the CSS selector uses MainContent with a capital C)

2. Change footer to Footer

With these changes, the page looked OK in Design View and in the browser.

Hope this helps.

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!
Reply With Quote
  #7 (permalink)  
Old May 15th, 2012, 11:04 AM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Location: Upstate NY
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

IE9. I would attach pics, but not sure if it is possible. I will try your suggestions. s.
Reply With Quote
  #8 (permalink)  
Old May 15th, 2012, 11:10 AM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Location: Upstate NY
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, Sugesstions worked. "Design" now looks same as in the browser. Thanks. I'll watch my case closer from now on. BTW, you book rocks! Fantastic resource.
Reply With Quote
  #9 (permalink)  
Old May 17th, 2012, 11:25 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
BTW, you book rocks! Fantastic resource.
Thank you!

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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging of master page and aspx page MohamedHassanAli BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 2 March 9th, 2011 12:42 AM
Setting the Master page hoses site... Page 92... richv BOOK: Beginning SharePoint 2010 Development 19 December 30th, 2010 10:21 AM
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
Master Page and Content Page with Java script Harjinder ASP.NET 2.0 Professional 1 February 1st, 2008 10:31 AM
Access Master page control from Content page. angshujit ASP.NET 2.0 Basics 3 January 11th, 2007 06:20 AM



All times are GMT -4. The time now is 04:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.