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 > ASP.NET 4 General Discussion
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 December 16th, 2010, 08:43 AM
Authorized User
Points: 150, Level: 2
Points: 150, Level: 2 Points: 150, Level: 2 Points: 150, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Location: Perth, Western Australia
Posts: 33
Thanks: 7
Thanked 1 Time in 1 Post
Send a message via MSN to cuddling101 Send a message via Yahoo to cuddling101
Question Grid Option in ListView Control

I am seeking to use the list control, as that will, I believe, give me the level of flexibility I am going to need to display my web page as I want. I am though, taking it in stages to get to the final page.

I am using the Grid option of List View.

I have defined a list view and the design view looks just how I would want it. A data record from the database shown on each row of the grid, but when I run it, I get a row showing the first field, a row showing the second field, and then a row showing the third and fourth field.

The data is all correct and what is in the database, but it just isn't laid out how I want it.

I have posted below the aspx markup, and the lines I added to styles.css.

The rows are quite tall because the next step is to pull in some image thumbnails, but that's the next step. The displayed page is picking up the height setting from styles.css.

Publishers.aspx

Code:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPages/Site.master" AutoEventWireup="false" CodeFile="Publishers.aspx.vb" Inherits="_Publishers" %>

<asp:Content ID="PublishersPageHead" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="PublishersBcrumb" ContentPlaceHolderID="cpBcrumb" Runat="Server">
</asp:Content>
<asp:Content ID="PublishersMainContent" ContentPlaceHolderID="cpMainContent" Runat="Server">
        <h1 align="center" style="color: #0066CC">How and Why Wonder Books</h1>
        <asp:Label ID="PublishersInstructions" runat="server"  
            BorderWidth="1px" Font-Names="Calibri" Font-Size="Large"           
            Text="Click on a publisher to see the list of titles produced under that imprint, click on a thumbnail to see details of that series type." 
            Width="1020px" CssClass="InstructionsHeader"></asp:Label>
        <br />
        <br />
        <br />
        <asp:ListView ID="ListView1" runat="server" DataSourceID="EntityDataSource1">
            <ItemTemplate>
                <tr style="">
                    <td width="180">
                        <asp:Label ID="Publisher_NameLabel" runat="server" 
                            Text='<%# Eval("Publisher_Name") %>' />
                    </td>
                    <td width="160">
                        <asp:Label ID="Place_of_PublicationLabel" runat="server" 
                            Text='<%# Eval("Place_of_Publication") %>' />
                    </td>
                    <td width="80">
                        <asp:Label ID="Series_PublishedLabel" runat="server" 
                            Text='<%# Eval("Series_Published") %>' />
                    </td>
                    <td width="50">
                        <asp:Label ID="Num_Sers_PublishedLabel" runat="server" 
                            Text='<%# Eval("Num_Sers_Published") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table class="ItemPlaceholderContainer">
                                <tr runat="server" style="">
                                    <th runat="server" width="180" align="center">
                                        Publisher</th>
                                    <th runat="server" width="160" align="center">
                                        Place</th>
                                    <th runat="server" width="80" align="center">
                                        Series Published</th>
                                    <th runat="server" width="50" align="center">
                                        # of Series</th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td id="TD_Publisher" runat="server" style="" class="ItemPlaceholderContainer">
                        </td>
                        <td id="TD_Place" runat="server" style="" class="ItemPlaceholderContainer">
                        </td>
                        <td id="TD_Series_Pub" runat="server" style="" class="ItemPlaceholderContainer">
                        </td>
                        <td id="TD_Series_Count" runat="server" style="" class="ItemPlaceholderContainer">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
        </asp:ListView>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=How_and_Why_Wonder_BooksEntities" 
            DefaultContainerName="How_and_Why_Wonder_BooksEntities" 
            EnableFlattening="False" EntitySetName="Publishers" 
            EntityTypeFilter="Publisher" 
            Select="it.[Publisher_Name], it.[Place_of_Publication], it.[Series_Published], it.[Num_Sers_Published]">
        </asp:EntityDataSource>
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <asp:Button ID="PublishersHome" runat="server" Text="Home" 
            CssClass="HomeButtons" PostBackUrl="~/Default.aspx"/>
        <br />
        <br />
</asp:Content>
<asp:Content ID="PublishersFooter" ContentPlaceHolderID="cpFooter" Runat="Server">
</asp:Content>
styles.css - the three new items just added

Code:
.ItemPlaceholderContainer
{
    width: 600px;
    list-style-type:none;
    clear:both;
}
.ItemPlaceholderContainer td
{
    height: 145px;
    float: left;
}
.ItemPlaceholderContainer td img
{
    width: 95px;
    margin: 10px 10px 10px 0;
}
I have posted screen images of the VWD view of the web page and the browser view (Firefox) at the free images server - FreeImageHosting.net as follows -

VWD view of screen:
http://www.freeimagehosting.net/imag...46515caef9.jpg

Browser view of screen:
http://www.freeimagehosting.net/imag...10c0ab395a.jpg

I look forward to replies, with many thanks in anticipation.

Best regards

Philip
Reply With Quote
  #2 (permalink)  
Old December 17th, 2010, 10:34 AM
Authorized User
Points: 150, Level: 2
Points: 150, Level: 2 Points: 150, Level: 2 Points: 150, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Location: Perth, Western Australia
Posts: 33
Thanks: 7
Thanked 1 Time in 1 Post
Send a message via MSN to cuddling101 Send a message via Yahoo to cuddling101
Red face Float left was the problem

Just in case anyone is interested, the problem proved to be the float left option in the style.
Code:
.ItemPlaceholderContainer td
{
    height: 145px;
    float: left;
}
I took the float left out and the problem went away. I also put the class and style against each individual item in the item template, example follows.

Code:
                    <td width="180" style="" class="ItemPlaceholderContainer">
                        <asp:Label ID="Publisher_NameLabel" runat="server" 
                            Text='<%# Eval("Publisher_Name") %>' />
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
Help with ListView Control in C# jiggsroger C# 2005 7 April 7th, 2008 04:25 AM
About Listview control yuetqu BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 August 15th, 2006 04:56 AM
ListView Control JelfMaria VB How-To 4 May 5th, 2005 12:39 AM
ListView Control jlr27613 C++ Programming 1 September 14th, 2004 12:58 PM
listview control jakeone Beginning VB 6 1 March 9th, 2004 08:29 AM



All times are GMT -4. The time now is 01:34 AM.


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