?
Solved

table doesn't expand when datalist is populated

Posted on 2009-04-12
5
Medium Priority
?
470 Views
Last Modified: 2012-05-06
I've created a dataList that reads a listing of events on a website. I have it sitting in a table, however when I view it, the dataList runs beyond the design of the website. The table doesn't expand when the database is read. I have the height at 100% all over the place. There's other design elements but the below code is just the datalist.
<div>
               <form id="form1" runat="server">
              <table width="760" height="100%" border="00" align="center" cellpadding="5" cellspacing="5">
                <tr height="100%">
                  <td valign="top" style="height: 100%">
                  
   
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/gridview.mdb"
            SelectCommand="SELECT [ID], [dateFormat], [description], [dateTime], [title] FROM [calendar] ORDER BY[dateFormat]asc"></asp:AccessDataSource>
        <asp:DataList ID="gridView" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
            BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataKeyField="ID"
            datasourceid="AccessDataSource1" GridLines="Both" style="z-index: 24; left: 355px;
            position: absolute; top: 379px" Width="572px" ShowHeader="False" Height="423px" Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False" Font-Size="Medium" Font-Strikeout="False" Font-Underline="False" ForeColor="Blue" ShowFooter="False">
          <footerstyle BackColor="#F7DFB5" ForeColor="#8C4510" />        
          <selecteditemstyle BackColor="Red" Font-Bold="True" ForeColor="White" />        
          <itemtemplate>
       
            <table style="height: 100%">
              <tr style="height: 100%">
                <td style="height: 100%; width: 647px;">description:
                  <asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' Height="100%"></asp:Label></td>
              </tr>
              <tr style="height: 100%">
                <td style="height: 27%; width: 647px;">dateTime:
                  <asp:Label ID="dateTimeLabel" runat="server" Text='<%# Eval("dateTime") %>'></asp:Label></td>
              </tr>
              <tr style="height: 100%">
                <td style="height: 100%; width: 647px;">title:
                  <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>'></asp:Label></td>
              </tr>
            </table>
          </itemtemplate>
          <itemstyle BackColor="#FFFFC0" Font-Bold="False" Font-Italic="False" Font-Names="Arial"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#804000"
                HorizontalAlign="Left" />        
          <headerstyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />        
          <edititemstyle ForeColor="Red" CssClass="csc.csc" Font-Bold="True" />        
</asp:DataList>
        <table width="750" style="height: 100%" border="00" align="center" cellpadding="5" cellspacing="5">
          <tr>
            <td style="height: 26px"><div align="center" class="Copysm"><a href="index.htm">Home</a> | <a href="ftDel.htm">Visit the Fort</a> | <a href="shopDine.htm">Shopping &amp; Dining</a> | <a href="events.htm">News &amp; Events</a> | <a href="contact.htm">Directions &amp; Contact </a>| <a href="mainst.htm">About Main Street </a></div></td>
          </tr>
        </table></td>
                </tr>
              </table> 
               </form></div>

Open in new window

0
Comment
Question by:designaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Expert Comment

by:dan_neal
ID: 24129746
Just to be sure, its truncating the height of the list?  Do you have any other styles controling the height of the DIV containg the table?  
0
 
LVL 1

Expert Comment

by:scripkilla
ID: 24129783
I am not really sure about all the style syntax that's been created in your code, but I can offer a few suggestions.  First, adding a height=100% to a <tr> is not necessary.  I also noticed that there are 3 tables: 1 'container' table with two other tables inside that one.  The two inside tables are not located in seperated table rows (<tr>) which may be why things are extending beyond your page design.  If you need that data to 'stack', then move one of the tables to a new row: <tr><td>*place table here*</td> </tr>.  If you need them to display side-by-side, add a new <td></td> to the 'container' table and place a table in that.  
0
 

Author Comment

by:designaire
ID: 24130731
The DataList is just sitting on top of everything but doesn't get truncated. It just runs off the page. I'lll have to look at the code again. I have a test page I'm running, I'll have post that tonight.
0
 

Author Comment

by:designaire
ID: 24132165
Here is a small sample. It contains the database information that sits inside a colored table. When the database expands the colored table should expand but it doesn't. The table is small and the database sits on top and extends beyond the table. The DatalList is in a form tag.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="delCityLong.aspx.vb" Inherits="delCityLong" %>
 
<!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>Untitled Page</title>
</head>
<body>
<table width="649" border="0" bordercolor="#ECE9D8" bgcolor="#333399">
  <tr>
    <td width="677"><form id="form1" runat="server">
    <div>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/gridview.mdb"
            SelectCommand="SELECT [title], [dateTime], [description], [dateFormat], [ID] FROM [calendar] ORDER BY [dateFormat] ASC"></asp:AccessDataSource>
        &nbsp;</div>
        <asp:DataList ID="DataList1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
            BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataKeyField="ID"
            DataSourceID="AccessDataSource1" GridLines="Both" Style="z-index: 24; left: 75px;
            position: absolute; top: 77px" Width="542px" ShowHeader="False">
            <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
            <SelectedItemStyle BackColor="Red" Font-Bold="True" ForeColor="White" />
            <ItemTemplate>  
            <table> <tr><td> <font face ="tahoma" color= "navy">    
                <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>'></asp:Label><br />
              </font>
                <asp:Label ID="dateTimeLabel" runat="server" Text='<%# Eval("dateTime") %>'></asp:Label><br />
                </td></tr></table>
                <asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>'></asp:Label><br />
                <br />
            </ItemTemplate>
            <ItemStyle BackColor="#FFFFC0" Font-Bold="False" Font-Italic="False" Font-Names="Arial"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#804000"
                HorizontalAlign="Left" />
            <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
            <EditItemStyle ForeColor="Red" CssClass="csc.csc" Font-Bold="True" />
        </asp:DataList>
 
        &nbsp;</form></td>
  </tr>
</table>
<br />
    
</body>
</html>

Open in new window

0
 

Accepted Solution

by:
designaire earned 0 total points
ID: 24133276
I just figured it out. I just changed the  setting from absolute to relative....  position: relative; top: 0px

asp:DataList ID="DataList1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
            BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataKeyField="ID"
            DataSourceID="AccessDataSource1" GridLines="Both" Style="z-index: 24; left: 71px;
            position: relative; top: 0px" Width="542px" ShowHeader="False">
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question