如何在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