Solved

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

Posted on 2010-11-08
7
363 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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

21 Experts available now in Live!

Get 1:1 Help Now