【问题标题】:How to left align footer element in GridView如何在 GridView 中左对齐页脚元素
【发布时间】:2011-05-25 06:19:44
【问题描述】:

我在对齐 GridView 的 FooterTemplate 中的元素时遇到问题。 任何人都建议我怎么做。代码是:

<asp:GridView ID="gvComment" runat="server" AutoGenerateColumns="false" 
OnRowDataBound="gvComment_RowDataBound" OnRowCreated="gvComment_RowCreated" Width="100%" ShowHeader="false" BorderWidth="0px" ShowFooter="true">
<Columns>
    <asp:TemplateField>
        <ItemTemplate>
            <table border="0" cellpadding="0" cellspacing="0" width="100%" >
                <tr>
                    <td valign="middle" align="left" style="width:10%"><img id="imgUser" src="" alt="" title="" runat="server" /></td>
                    <td align="left" valign="top">
                        comment comment
                        <asp:Label ID="lblNameComments" runat="server" Visible="false" ></asp:Label>
                    </td>
                </tr>
                <tr><td colspan="2" style="height:7px;"></td></tr>
                <tr>
                    <td colspan="2" style="padding-top:10px;background-image:url(../Images/dotted_line.jpg);background-repeat:repeat-x;background-position:center;"></td>
                </tr>
                <tr><td colspan="2" style="height:7px;"></td></tr>
            </table>            
        </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField>
        <FooterTemplate >
        <table border="0" cellpadding="0" cellspacing="0" width="100%" >
            <tr>
                <td align="left">
                    Footer Text
                   Footer Text
                   Footer Text         
                </td>
            </tr>
        </table>
        </FooterTemplate>
    </asp:TemplateField>
</Columns>
</asp:GridView>

我设置了 td left 的 align 属性,但它不起作用。页面输出如图所示。

【问题讨论】:

    标签: gridview footer


    【解决方案1】:

    您是否尝试从&lt;FooterTemplate &gt; 在表中添加align="left"

    <table border="0" cellpadding="0" cellspacing="0" width="100%" align="left">
    <tr>
        <td align="left">
           Footer Text
           Footer Text
           Footer Text         
        </td>
    </tr>
    </table>
    

    【讨论】:

    • 实际上有一些对齐问题。现在我已经做到了。谢谢阿德里安。
    猜你喜欢
    • 1970-01-01
    • 2012-07-03
    • 2022-11-25
    • 1970-01-01
    • 1970-01-01
    • 2011-02-12
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    相关资源
    最近更新 更多