Click here to Skip to main content
15,885,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am unable to allign the text in cell of grid view
HTML
<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
Posted
Updated 9-Jan-13 0:15am
v2
Comments
[no name] 9-Jan-13 6:20am    
once please conform me are you using GridView or DataGrid
shivani 2013 9-Jan-13 6:34am    
grid view

use Class for HeaderStyle

<headerstyle cssclass="GridHeaderRowClass" />


CSS
.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;
}



XML
<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>
 
Share this answer
 
v2
Comments
shivani 2013 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".
shivani 2013 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 "
shivani 2013 9-Jan-13 7:24am    
no change
Try this
XML
<RowStyle HorizontalAlign="Center" />
<AlternatingRowStyle HorizontalAlign="Center" />
 
Share this answer
 
simple dude ,,
we have to use the css for alignment or othertype of styling
 
Share this answer
 
Comments
shivani 2013 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900