Solved

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

Posted on 2010-11-08
7
365 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASCX file or a newer alternative? 1 34
VB: Convert 2 dates to specific format 24 48
Fulfillment API php code sample 1 37
insert value of checklistbox checked 4 25
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

813 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

15 Experts available now in Live!

Get 1:1 Help Now