Results 1 to 3 of 3

Thread: how to fit the image to the width of the datagrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2003
    Location
    michigan
    Posts
    70

    how to fit the image to the width of the datagrid

    VB Code:
    1. <Asp:datagrid Allowpaging="true" Page-Index="5">
    2. <columns>
    3. <asp:TemplateColumn>
    4. <ItemTemplate>
    5. <Img src="sam.gif" width="200" height="150" />
    6. </ItemTemplate>
    7. </asp:TemplateColumn>
    8. <asp:TemplateColumn>
    9. <ItemTemplate>
    10. <table>
    11. <tr><td><%#Container.DataItem("ID")%></td></tr>
    12. <tr><td><%#Container.DataItem("Name")%></td></tr>
    13. </table>
    14. </ItemTemplate>
    15. </asp:TemplateColumn>
    16. </Columns>
    17. </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...

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Try setting the following properties on your datagrid. This may or may not work, depending upon your image:

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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2003
    Location
    michigan
    Posts
    70
    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....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width