Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 ASP.NET .NET4
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
Posted 9-Jan-13 0:51am
Edited 9-Jan-13 1:15am
v2
Comments
Member 7882565 at 9-Jan-13 6:34am
   
grid view
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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>
  Permalink  
v2
Comments
Member 7882565 at 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 at 9-Jan-13 6:58am
   
its ur wish. u can create either "sytelsheet or Skin File".
Member 7882565 at 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 at 9-Jan-13 7:04am
   
please check my updated solution. Added there HeaderStyle-CssClass="GridHeaderRowClass "
Member 7882565 at 9-Jan-13 7:24am
   
no change
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

Solution 3

simple dude ,,
we have to use the css for alignment or othertype of styling
  Permalink  
Comments
Member 7882565 at 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
0 BillWoodruff 360
1 Mathew Soji 309
2 Maciej Los 270
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 202
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
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