Re: DataList column alignment?

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Wed, 22 Jun 2005 06:34:03 -0700, Ben Fidge wrote:

> I'm using DataList to present tabular data but am often having problems with
> some rows column alignment being out of synch with the rest of the rows.
>
> My DataList looks similar to this...:
>
> <asp:datalist id="DataList1" runat="server">
> <HeaderTemplate>
> <table border="0" cellpadding="0" cellspacing="0" width="400">
> <tr>
> <td width="100">First Name</td>
> <td width="100">Surname</td>
> <td width="100">DOB</td>
> <td width="100">Gender</td>
> </tr>
> </table>
> </HeaderTemplate>
> <ItemTemplate>
> <table>
> <tr>
> <td width="100"><%# DataBinder.Eval(Container.DataItem,
> "firstname") %></td>
> <td width="100"><%# DataBinder.Eval(Container.DataItem,
> "surname") %></td>
> <td width="100"><%# DataBinder.Eval(Container.DataItem, "dob")
> %></td>
> <td width="100"><%# DataBinder.Eval(Container.DataItem,
> "gender") %></td>
> </tr>
> </table>
> </ItemTemplate>
> </asp:datalist>
>
> ...but if any data exceeds the maximum width of it's column, that particular
> "cell" is getting expanded to accomodate the data. I think the problem lies
> in using tables in the <ItemStyle> tags, so for each row, the table is
> automatically altered to accomodate the data it hold. Of course, this makes
> the final output look unprofessional.
>
> Is there any way round this?
>
> Thanks
> Ben
The Header should have the table but not the table end. There should not
be a table in the ItemTemplate (unless it is for another purpose)

.



Relevant Pages

  • Re: DataList column alignment?
    ... Eliyahu ... > I'm using DataList to present tabular data but am often having problems ... > some rows column alignment being out of synch with the rest of the rows. ... > automatically altered to accomodate the data it hold. ...
    (microsoft.public.dotnet.framework.aspnet)
  • DataList column alignment?
    ... I'm using DataList to present tabular data but am often having problems with ... some rows column alignment being out of synch with the rest of the rows. ... automatically altered to accomodate the data it hold. ...
    (microsoft.public.dotnet.framework.aspnet)