Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-08
7
Medium Priority
?
388 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 668 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 1332 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 1332 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

879 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