Solved

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

Posted on 2010-11-08
7
364 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:dshrenik
  • 4
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
OBonio earned 167 total points
ID: 34084163
CSS is your best bet.  Using CssClass of the ImageButton, give them a class with left-padding: 5px;.
0
 

Author Comment

by:dshrenik
ID: 34084184
If possible, can you give the some sample code? Thanks!
0
 

Author Comment

by:dshrenik
ID: 34084235
The following code is not working:
    <style>

    ImageButton {

        left-padding: 15px;

    }

    </style>

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:dshrenik
ID: 34084256
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".
0
 
LVL 4

Assisted Solution

by:vinodch
vinodch earned 333 total points
ID: 34084439
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">
    .imgMargin
    {
    margin-left:3px;
    margin-right : 3px;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="gvData" OnRowDataBound="gvData_RowDataBound" AutoGenerateColumns="false" runat="server">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <img src="images/image1.jpg" class="imgMargin" />
                    </ItemTemplate>
                   
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
0
 
LVL 4

Assisted Solution

by:vinodch
vinodch earned 333 total points
ID: 34084448
place style inside head tag
0
 

Author Comment

by:dshrenik
ID: 34084532
Great. Thanks!

Just a comment about assigning class for dynamically created ImageButtons.
The following code is required:
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help on C# Linq query on object 6 53
Data is not showing from images 15 37
Error in JQuery 5 39
WCF Service Application cannot connect from TCP terminal 1 14
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now