CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Sep 2010
    Posts
    9

    [newby] ListView items don't appear under their columns

    I am a newby, I am trying to display a database table with the ListView component in a ASP.NET project. The data is shown, but the 2nd column doesn't appear right under the column title...

    CustomerID CompanyName
    12MediaMarkt
    13Lidl

    I implemented it myself, without using the MSVC wizard. Anyone an idea what it is? The source is shown under...

    Thanks for the help
    Alex

    -----

    PHP Code:
    <&#37;@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

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

        <
    style type="text/css">
            .
    TableCSS
            
    {
                
    border-style:none;
                
    background-color:IndianRed;
                
    width700px;
                }
                
            .
    TableHeader
            
    {
                
    background-color:Crimson;
                
    color:Snow;
                
    font-size:large;
                
    font-family:Verdana;
                
    height:45px;
                
    text-align:center;
                }    
            .
    ItemCSS
            
    {
                
    background-color:IndianRed;
                
    color:Snow;
                
    font-family:MS Sans Serif;
                
    font-size:medium;
                
    font-weight:bold;
                
    height:28px;
                }  
        </
    style>

    </
    head>
    <
    body style="height: 526px">
        <
    form id="form1" runat="server">

        <
    asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="myItemPlaceHolder" DataKeyNames="CustomerID">
             <
    ItemTemplate>
                <
    table id="itemPlaceholderContainer" runat="server" class="ItemCSS">
                    <
    tr id="Tr2" runat="server">
                        <
    td id="Td4" runat="server">
                            <
    asp:Label ID="Td1" runat="server" Text='<%# Eval("CustomerID") %>' />
                        </
    td>

                        <
    td id="Td5" runat="server">
                            <
    asp:Label ID="Td2" runat="server" Text='<%# Eval("CompanyName") %>' />
                        </
    td>
                    </
    tr>
                </
    table>
            </
    ItemTemplate>

            <
    LayoutTemplate>
                <
    table id="itemPlaceholderContainer" runat="server" class="TableCSS" >
                    <
    tr runat="server" class="TableHeader">
                        <
    th id="Td1" runat="server">Customer ID</th>
                        <
    th id="Td2" runat="server">CompanyName</th>
                        <
    th id="Td3" runat="server">Contact Name</th>
                    </
    tr>
                    <
    tr runat="server" class="ItemCSS">
                    </
    tr>
                </
    table>

                        <
    asp:PlaceHolder ID="myItemPlaceHolder" runat="server">
                        </
    asp:PlaceHolder>

            </
    LayoutTemplate>    
        </
    asp:ListView>

        </
    form>
    </
    body>
    </
    html
    Last edited by radioworld2007; September 24th, 2010 at 09:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured