images in a DataList - no dead space

S

sklett

I had this working at some point... then something happened.
I have a DataList that is set to repeat vertically, I have an asp:image in
each ItemTemplate and the whole thing comes together to work as a navigation
control. I noticed that I now have the smallest little gap between the
image and the top of the cells, 1-2 pixels.

I remember this used to be an issue of having the closing </td> tag on the
same line as the <img> tag or something like that. I have tried everything
to get this to work... but, no luck and it is now driving me insane.

Is there some place where I can read these tricks so that I can practice
swapping things around to get rid of the gap? Any ideas?

Here is what the code looks like that is generating the problem:
<asp:DataList id="dl_nav" runat="server" CellPadding="0">
<ItemTemplate>
<asp:HyperLink ID="navLink" Runat="server">
<asp:Image ID="navImg" Runat="server" />
</asp:HyperLink>
</ItemTemplate>
<SelectedItemTemplate>
<asp:HyperLink ID="navLink" Runat="server">
<asp:Image ID="navImg" Runat="server" />
</asp:HyperLink>
<div style="padding-left: 30px; background: #ffffff;">
<asp:DataList ID="navChildren" Runat="server" CellPadding="2"
OnItemDataBound="navChildren_ItemDataBound">
<ItemStyle CssClass="navSub" />
<ItemTemplate>
<asp:HyperLink ID="navSubLink" Runat="server" CssClass="navLink" />
</ItemTemplate>
</asp:DataList>
</div>
</SelectedItemTemplate>
</asp:DataList>



Any help will be GREATLY appreciated!

Thanks,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top