如何在GridView中左对齐页脚元素 [英] How to left align footer element in GridView
本文介绍了如何在GridView中左对齐页脚元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都会告诉我如何去做。代码是:
pre $ lt; code>< asp:GridView ID =gvComment runat =serverAutoGenerateColumns =false
OnRowDataBound =gvComment_RowDataBoundOnRowCreated =gvComment_RowCreatedWidth =100%ShowHeader =falseBorderWidth =0pxShowFooter =true>
<列>
< asp:TemplateField>
< ItemTemplate>
< table border =0cellpadding =0cellspacing =0width =100%>
< tr>
< td valign =middlealign =leftstyle =width:10%>< img id =imgUsersrc =alt =title =runat =服务器/>< / td>
< td align =leftvalign =top>
comment comment
< asp:Label ID =lblNameCommentsrunat =serverVisible =false>< / asp:Label>
< / td>
< / tr>
< tr>< td colspan =2style =height:7px;>< / td>< / tr>
< tr>
< td colspan =2style =padding-top:10px; background-image:url(../ Images / dotted_line.jpg); background-repeat:repeat-x; background-position:center ;>< / TD>
< / tr>
< tr>< td colspan =2style =height:7px;>< / td>< / tr>
< / table>
< / ItemTemplate>
< / asp:TemplateField>
< asp:TemplateField>
< FooterTemplate>
< table border =0cellpadding =0cellspacing =0width =100%>
< tr>
< td align =left>
页脚文本
页脚文本
页脚文本
< / td>
< / tr>
< / table>
< / FooterTemplate>
< / asp:TemplateField>
< /列>
< / asp:GridView>
我已经设置了td left的属性,但它不起作用。
解决方案
您是否试图在 align =left
>< FooterTemplate> ?
< table border =0cellpadding =0 cellspacing =0width =100%align =left>
< tr>
< td align =left>
页脚文本
页脚文本
页脚文本
< / td>
< / tr>
< / table>
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.
解决方案
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>
这篇关于如何在GridView中左对齐页脚元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文