如何在gridview列中对齐文本 [英] how to allign the text in a column of gridview

查看:190
本文介绍了如何在gridview列中对齐文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在网格视图的单元格中对齐文本

i am unable to allign the text in cell of grid view

<HeaderStyle BackColor="Maroon" Font-Names="Arial Black" ForeColor="White" Height="50px" HorizontalAlign="Center" VerticalAlign="Middle" />

<itemstyle height="80px" horizontalalign="Center" verticalalign="Bottom" />



的设计时间我得到但不是在运行时间

问候


in design time i am getting but not at run time
regards

推荐答案

使用Class for HeaderStyle



< headerstyle cssclass =GridHeaderRowClass/>





use Class for HeaderStyle

<headerstyle cssclass="GridHeaderRowClass" />


.GridHeaderRowClass
{
    font-family: Tahoma,Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: normal;
    background-color: #303030;
    color: White;
    height: 25px;
    padding: 0px 4px 0px 4px;
    text-transform: uppercase;
    height: 30px;
    text-align: left;
    white-space: nowrap;
}










<asp:TemplateField HeaderText="GroupName" SortExpression="GroupName" HeaderStyle-CssClass="GridHeaderRowClass "

                                ItemStyle-CssClass="GridCellClass TextAlignCenter" ItemStyle-Width="180px">
                                <ItemTemplate>
                                    <asp:Label ID="lblGroupName" runat="server" ToolTip='<%# GetDynamicToolTip("Section",Convert.ToString(DataBinder.Eval(Container.DataItem,"GroupName"))) %>'

                                        Text='<%# FormatColumn(Convert.ToString(DataBinder.Eval(Container.DataItem,"GroupName"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>


试试这个

Try this
<RowStyle HorizontalAlign="Center" />
<AlternatingRowStyle HorizontalAlign="Center" />


简单的家伙,

我们必须使用css进行对齐或其他样式
simple dude ,,
we have to use the css for alignment or othertype of styling


这篇关于如何在gridview列中对齐文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆