Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3550
Disable inherited padding
posted

I have a dropdown inside td.

The td padding is set to 4px.

I dont want the dropdown to inherit from the td.

I even wrap it with div that is set to 0px;

But it inherits the 4px of the td.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication12.WebForm1" %>

<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.ListControls" TagPrefix="ig" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style media="screen" type="text/css">      
        .pad4 td
        {
            border: 1px solid black;
            padding: 4px;
        }
        .pad0
        {
            padding: 0px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <ig:WebScriptManager ID="WebScriptManager1" runat="server">
    </ig:WebScriptManager>
    <table class="pad4">
        <tr>
            <td>
                <div class="pad0">
                    <ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px">
                    </ig:WebDropDown>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

  • 15320
    Verified Answer
    Offline posted

    Hello DR,

    I'm just checking whether you were able to resolve your issue? If you have any further questions, please feel free to contact me.

     

    Sincerely,

    Tsanna

  • 15320
    Offline posted

    Hello DR,

    Thank you for posting in Infragistics forum!

    When you attempt to set a padding property to the cell in the table, then its content, in this case the WebDropDown, will inherit the padding. For your reference, you can try this behavior with nested tables and see that setting padding property to the td element which belongs to the parent table class, will occur expansion of all the children td elements. What can I suggest in this case is to set a “cellpadding” property in the table tag in order to prevent the WebDropDown expansion. Another approach could be also setting the padding property only to the table class and then the padding will be applied between the table cell and the table border. I’m attaching you also a sample with similar scenario for instance. Please let me know if this helps.

     

    Sincerely,

    Tsanna

    WebDropDownTablePadding.zip