PDA

Click to See Complete Forum and Search --> : how to fit the image to the width of the datagrid


cooldudeattitud
Apr 27th, 2004, 07:59 AM
<Asp:datagrid Allowpaging="true" Page-Index="5">
<columns>
<asp:TemplateColumn>
<ItemTemplate>
<Img src="sam.gif" width="200" height="150" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<table>
<tr><td><%#Container.DataItem("ID")%></td></tr>
<tr><td><%#Container.DataItem("Name")%></td></tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>


Hi, I was trying to do this and I get the image at some distance from the borders....All I want is how do I fit the image or text to the datagrid cell....Ur help will be appreciated....But there are some white spaces coming between the borders of the cell and image/text in the datagrid.....Any kind of help will be appreciated...

Lethal
Apr 27th, 2004, 09:38 AM
Try setting the following properties on your datagrid. This may or may not work, depending upon your image:


<asp:datagrid runat="server" CellPadding="0" CellSpacing="0">
...

cooldudeattitud
Apr 27th, 2004, 10:12 AM
Hi Lethal thanks for ur reply,,,,

I already put that but still no luck with that....Any more suggestions...I also set the table cellspacing and cellpadding to 0 but still no luck....