Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 410
  • Last Modified:

Spacing between images in a table cell (ASP.NET C#)

I have multiple ImageButtons in a single cell of table in my .aspx page. The ImageButtons and the table are generated dynamically.

Please tell me how I can change the spacing between them.
  • 4
  • 2
3 Solutions
CSS is your best bet.  Using CssClass of the ImageButton, give them a class with left-padding: 5px;.
dshrenikAuthor Commented:
If possible, can you give the some sample code? Thanks!
dshrenikAuthor Commented:
The following code is not working:
    ImageButton {
        left-padding: 15px;

Open in new window

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

dshrenikAuthor Commented:
Also, can you tell me where I need to add this code in my .aspx page?
When I add it inside a ContentPlaceHolder, it says that "Element 'Style' cannot be nested within element 'div".
below is the code which may helps you, provide margin for image

<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" src="Js/jquery.min.js"></script>
    <style type="text/css">
    margin-right : 3px;
    <form id="form1" runat="server">
        <asp:GridView ID="gvData" OnRowDataBound="gvData_RowDataBound" AutoGenerateColumns="false" runat="server">
                        <img src="images/image1.jpg" class="imgMargin" />
place style inside head tag
dshrenikAuthor Commented:
Great. Thanks!

Just a comment about assigning class for dynamically created ImageButtons.
The following code is required:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now