Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
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 October 18th, 2012, 02:06 PM
Friend of Wrox
Points: 595, Level: 8
Points: 595, Level: 8 Points: 595, Level: 8 Points: 595, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default Chapter 14 - p.510, step #13

Hi Imar,

I'm having trouble getting this step to work. I created the styles.css file and added it to my master page, but I'm not seeing it being applied. I'm not sure what I'm doing wrong?

I've included the master page

Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="FrontEnd.master.cs" Inherits="MasterPages_MasterPage" %>


<!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">  

        <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"><a id="A1" href="~/" runat="server"></a></div>

          <div id="MenuWrapper">
                <asp:Menu ID="Menu1" runat="server" cssclass="MainMenu"
                    DataSourceID="SiteMapDataSource1" Orientation="Horizontal" 
                    StaticEnableDefaultPopOutImage="False" 
                    onmenuitemclick="Menu1_MenuItemClick">
                 </asp:Menu>

                <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" 
                    ShowExpandCollapse="False">
                    <LevelStyles>
                        <asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />                                                
                    </LevelStyles>    
                    <NodeStyle  BackColor="White"/>                
                </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>
          <div id="Sidebar">
            Select a Theme:  <br />
            <asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" 
                  onselectedindexchanged="ThemeList_SelectedIndexChanged">
                <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>

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

        </div>
    </form>
</body>

</html>
Thank you.
Tulsi
Reply With Quote
  #2 (permalink)  
Old October 19th, 2012, 03:24 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Can you post the code for the style sheet and for the ListView?

Also, check if Styles.css is being applied at all, for example by adding a Universal selector like this:

Code:
 
*
{
  border: 2px solid Red;
}
That gives everything in the page a red border so you can quickly see if Styles.css is loaded and applied.

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 October 22nd, 2012, 03:26 PM
Friend of Wrox
Points: 595, Level: 8
Points: 595, Level: 8 Points: 595, Level: 8 Points: 595, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default

Hi Imar,

I tested out the style sheed code... It looks like styles.css is being loaded and applied since I see the red border.

Here's the code for styles.css:

Code:
*
{
  border: 2px solid Red;
}

.ItemContainer
{
  width: 600px;
  list-style-type: none;
  clear: both;
}

.ItemContainer li
{
  height: 300px;
  width: 200px;
  float: left;
}

.ItemContainer li img
{
  width: 180px;
  margin: 10px 20px 10px 0;
}

Code for listview..

Code:
<%@ Page Title="Manage Photo Album" Language="C#" MasterPageFile="~/MasterPages/FrontEnd.master" AutoEventWireup="true" CodeFile="ManagePhotoAlbum.aspx.cs" Inherits="ManagePhotoAlbum" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <asp:ListView ID="ListView1" runat="server" DataSourceID="EntityDataSource1" 
        DataKeyNames="Id" InsertItemPosition="LastItem" 
        onselectedindexchanged="ListView1_SelectedIndexChanged" 
        oniteminserting="ListView1_ItemInserting">
                        
        <InsertItemTemplate>
            <li style="">
                Description:
                <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' TextMode="MultiLine" />
                <asp:RequiredFieldValidator ID="reqDesc" runat="server" ErrorMessage="Enter a description." ControlToValidate="DescriptionTextBox"></asp:RequiredFieldValidator>

                <br />ToolTip:
                <asp:TextBox ID="ToolTipTextBox" runat="server" Text='<%# Bind("ToolTip") %>' />
                <asp:RequiredFieldValidator ID="reqToolTip" runat="server" ErrorMessage="Enter a tool tip." ControlToValidate="ToolTipTextBox"></asp:RequiredFieldValidator>

                <br />             
                <asp:FileUpload ID="FileUpload1" runat="server" />
                <asp:CustomValidator ID="cusValImage" runat="server" ErrorMessage="Select a valid .jpg file."></asp:CustomValidator>
                <br />                
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" CausesValidation="False" />
            </li>
        </InsertItemTemplate>
        
        <ItemTemplate>
            <li style="">                
                Description:
                <asp:Label ID="DescriptionLabel" runat="server" 
                    Text='<%# Eval("Description") %>' />
                <br />
                ToolTip:
                <asp:Label ID="ToolTipLabel" runat="server" Text='<%# Eval("ToolTip") %>' />
                <br />                
                <asp:Image ID="ImageUrl" runat="server" ImageUrl='<%# Eval("ImageUrl") %>'/>
                <br />                                
                <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                    Text="Delete" CausesValidation="False" />
            </li>
        </ItemTemplate>

        <LayoutTemplate>
            <ul>
                <li runat="server" id="itemPlaceholder" />
            </ul>            
        </LayoutTemplate>    
            
    </asp:ListView>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=PlanetWroxEntities" 
        DefaultContainerName="PlanetWroxEntities" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EntitySetName="Pictures" 
        EntityTypeFilter="" Select="" Where="it.PhotoAlbumId = @photoAlbumId" 
        oninserting="EntityDataSource1_Inserting">
        <WhereParameters>
            <asp:QueryStringParameter Name="PhotoAlbumId" QueryStringField="PhotoAlbumId" 
                Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpClientScript" Runat="Server">
</asp:Content>
Thank you.

Tulsi
Reply With Quote
  #4 (permalink)  
Old October 22nd, 2012, 03:28 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Tulsi,

Look like you missed "Then add a class attribute and set it to ItemContainer." in step 9 on page 508. Since the CSS targets ItemContainer and its child elements, it's important to have that class on your ul.

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
  #5 (permalink)  
Old October 25th, 2012, 12:56 PM
Friend of Wrox
Points: 595, Level: 8
Points: 595, Level: 8 Points: 595, Level: 8 Points: 595, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default

Thank you Imar. I added that class attribute and everything works great now.

Thank you again.

Tulsi
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
Chapter 10, Step 14 rserna BOOK: Beginning iOS Game Development 0 September 28th, 2012 04:32 PM
Ch 14: Try it Out p. 510 - error 'PlanetWroxModel.Picture' is a 'type' jayinatlanta BOOK: Beginning ASP.NET 4 : in C# and VB 2 November 5th, 2011 09:50 AM
Chapter 14 page 508 step 10 possible error oruckenan BOOK: Beginning ASP.NET 4 : in C# and VB 3 July 27th, 2011 12:10 PM
chapter 14 Try It Out pg 505 step #4 arodrigu12 BOOK: Beginning ASP.NET 4 : in C# and VB 3 April 21st, 2011 02:28 PM
Chapter 13 Page 470 Step 14 bagellady BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 September 17th, 2010 12:36 PM



All times are GMT -4. The time now is 06:05 PM.


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