Click here to Skip to main content
13,091,537 members (58,606 online)
Rate this:
Please Sign up or sign in to vote.
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
Posted 8-Jan-13 23:51pm
Updated 9-Jan-13 0:15am
pranathis012 9-Jan-13 6:20am
once please conform me are you using GridView or DataGrid
Member 7882565 9-Jan-13 6:34am
grid view
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

use Class for HeaderStyle

<headerstyle cssclass="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">
                                    <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>
Member 7882565 9-Jan-13 6:53am
for this i need to create style sheet or what.plz telll in detail.i m new to this
Sanjeev Alamuri 9-Jan-13 6:58am
its ur wish. u can create either "sytelsheet or Skin File".
Member 7882565 9-Jan-13 6:59am
i created style sheet and wrote above code and linked it to the form source code but in headerstyle---->cssclass i wrote .GridHeaderRowClass bbut on run timne no change.have i missed something
Sanjeev Alamuri 9-Jan-13 7:04am
please check my updated solution. Added there HeaderStyle-CssClass="GridHeaderRowClass "
Member 7882565 9-Jan-13 7:24am
no change
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try this
<RowStyle HorizontalAlign="Center" />
<AlternatingRowStyle HorizontalAlign="Center" />
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

simple dude ,,
we have to use the css for alignment or othertype of styling
Member 7882565 9-Jan-13 7:25am
why then why it has been given properties in grid view

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100