【问题标题】:Style for nested gridview asp.net嵌套gridview asp.net的样式
【发布时间】:2010-10-25 14:56:36
【问题描述】:

您好,我使用嵌套的 GridView 在 mainGrid 视图中显示客户,在内部 GridView 中显示 CustomerDetails。对于外部 GridView,有一个 4px 的 CellPadding 集。现在,当我使用嵌套的 gridview 时,我不希望为包含 InnerGridView 的单元格应用填充。请帮我解决一下这个。自 4-5 小时以来,我一直被困在这个问题上,找不到任何解决方法。

问候, 严酷的

【问题讨论】:

    标签: asp.net html gridview coding-style nested


    【解决方案1】:

    在单元格级别尝试style="padding top right bottom left",而不是在表格级别尝试CellPadding

    这是一个例子:

    <table border = 1>
    <tr>
    <td style="padding:10">Some text with 10 padding all around</td>
    <td>Some other text without padding</td>
    <tr>
    <tr>
    <td style="padding:0 10 0 10">Some text with padding on the sides only</td>
    <td>Some text without padding</td>
    </tr>
    </table>
    

    【讨论】:

    • 嗨,丹尼,感谢您的建议,但我使用的是在内部呈现表格的 GridView。所以不能直接为每个单元格设置不同的填充。
    • 尽管我得到了在 RowDataBound-e.Row.Cells[3].Attributes.Add("style", "padding:0px;"); 中添加以下行的解决方案e.Row.Cells[4].Attributes.Add("style", "padding:0px;");但仍然无法将 GridLines 添加到嵌套的 gridview Rows。
    • 得到了解决方案。不得不请 UI 设计师为嵌套表格创建样式。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-19
    相关资源
    最近更新 更多