How to left align footer element in GridView

偶尔善良 提交于 2019-12-13 04:34:34

问题


I am getting problem in alignment of element that is in FooterTemplate of GridView. Anyone suggest me how to do it.The Code is:

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

I have set align property of td left but it doesn't work.Page output shown in image.


回答1:


Have you tried to add align="left" on the table from <FooterTemplate > ?

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


来源:https://stackoverflow.com/questions/4439211/how-to-left-align-footer-element-in-gridview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!