这几天被dataList的嵌套后的格式问题整的晕死了,上周五开周会的时候应为领导的一句话害我晕了几天。“这些应用的图标一样还不如不要呢。”,靠我又有事情刚了,开始还以为就是不要图片嘛,这个简单。结果不是那么回事,图标去掉后仅仅是文字更难看。哎,只好改他的布局了。
dataList嵌套后大类的dataList要显示三列,每一列中嵌套一个小类的dataList由于每个小类的dataList的列数不同会影响到显示效果。样式如下:
AA BB CC 但实际的效果是: BB
aa bb cc AA bb
aa bb aa bb CC
aa bb aa bb cc
bb aa bb
bb bb
dataList嵌套后就不知怎么设置样式了,就因为这样式结果整了我好几天。最后决定放弃dataList嵌套的方式,改用将第一个dataList用
Repeater代替,因为在Repeater的ItemTemplate循环中可以设置table的样式。这样问题就解决了。
<table width="1000" height="auto" border="0" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td style=" margin-top:0px; padding-top:0px;">
<asp:DataList runat="server" DataKeyField="sec_shortening" ID="DataList1" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"><ItemTemplate></ItemTemplate></asp:DataList>
<asp:Repeater ID="repDalei" runat="server">
<ItemTemplate>
<table style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:auto; text-align:left; width:330px; padding-top:0px; float:right; overflow:hidden;" border="0">
<tr>
<td style="height: 27px; background-image:url(images/1_101c.gif);width:315px; background-repeat:no-repeat;">
<asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"sec_classname") %>'></asp:Label>
</td>
</tr>
<tr>
<td style=" height:auto;">
<asp:DataList ID="DataList2" runat="server" DataKeyField="appname" RepeatColumns="1"
RepeatDirection="Horizontal" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" ShowFooter="False" ShowHeader="False">
<ItemTemplate>
<table>
<tr>
<td style=" height:auto;">
<asp:Image ID="Image1" runat="server" ToolTip='<% #DataBinder.Eval(Container.DataItem,"appname")%>' ImageUrl='~/AppImages/bsh.gif' Width="12px" Height="12px"/> <a href='<%#DataBinder.Eval(Container.DataItem,"appurl")%>'><asp:Label ID="Label2" runat="server" ToolTip='<% #DataBinder.Eval(Container.DataItem,"appname")%>' Text='<% #DataBinder.Eval(Container.DataItem,"appname")%>' Font-Underline="false" ForeColor="black"></asp:Label></a>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" />
<SelectedItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" />
<AlternatingItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False" />
<ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" />
<SeparatorStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" />
</asp:DataList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>