G
Guest
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
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